大小端模式转换函数

#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);

htonl 表示 host to network long ,用于将主机 unsigned int 型数据转换成网络字节顺序;
htons 表示 host to network short ,用于将主机 unsigned short 型数据转换成网络字节顺序;
ntohl、ntohs 的功能分别与 htonl、htons 相反。