htons: Translate a short integer
The htons socket function translates a short integer from host byte order to network byte order.
Last updated
Added for PUT00.
Format
#include <sys/types.h>
#include <sys/socket.h>
u_short htons(u_short a);
- a
- Unsigned short integer to be put into network byte order.
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 <sys/types.h>
#include <sys/socket.h>
⋮
u_short a;
u_short n;
⋮
n = htons(a);Related information
See z/TPF Transmission Control Protocol/Internet Protocol for information about z/TPF TCP/IP support.