htonl():
将主机的无符号长整形数转换成网络
字节顺序。
#include <arpa/inet.h>
uint32_t htonl(uint32_t hostlong);
hostlong:主机
字节顺序表达的32位数。
htonl()返回一个网络
字节顺序的值。
ntohl():
将一个无符号长整形数从网络
字节顺序转换为主机字节顺序。
#include <arpa/inet.h>
uint32_t ntohl(uint32_t netlong);
netlong:一个以网络[
字节顺序表达的32位数。
ntohl()返回一个以主机
字节顺序表达的数。
htons():
将一个无符号短整型的主机数值转换为网络字节顺序
ntohs():
将一个无符号短整形数从网络字节顺序转换为主机字节顺序。