gtpc1m3y | Transmission Control Protocol/Internet Protocol |
The htons function translates a short integer from host byte order to network byte order.
Format
#include <types.h> #include <socket.h> u_short htons(u_short a);
Normal Return
Returns the translated short integer.
Error Return
None.
Programming Considerations
None.
Examples
The following example converts the information from host byte order to network byte order.
#include <types.h> #include <socket.h>
·
·
·
u_short a; u_short n;
·
·
·
n = htons(a);
Related Information