htonl, htons, ntohl, ntohs -호스트와 네트웍 바이트 순서 사이로 값들을 바꾼다.
#include <arpa/inet.h>
uint32_t htonl(uint32_t hostlong);
uint16_t htons(uint16_t hostshort);
uint32_t ntohl(uint32_t netlong);
uint16_t ntohs(uint16_t netshort);
The htonl() function converts the unsigned integer hostlong from host byte order to network byte order.
The htons() function converts the unsigned short integer hostshort from host byte order to network byte order.
The ntohl() function converts the unsigned integer netlong from network byte order to host byte order.
The ntohs() function converts the unsigned short integer netshort from network byte order to host byte order.
i386에서, 호스트 바이트 순서는 Least Significant Byte가 앞에 오고, 반면에 Internet에서 사용되고 있는 네트웍 바이트 순서는 Most Significant Byte가 앞에 온다.
이 섹션에서 사용되는 용어에 대한 설명은 attributes(7)EN을 참조하십시오.
| 상호 작용 | 속성 | 번호 |
| htonl(), htons(), ntohl(), ntohs() | Thread safety | MT-Safe |
POSIX.1-2001, POSIX.1-2008.