htons,ntohs,htonl,ntohl(cp:http://blog.csdn.net/libuding/article/details/5860578)
网络字节顺序是TCP/IP中规定好的一种数据表示格式,它与具体的CPU类型、操作系统等无关,从而可以保证数据在不同主机之间传输时能够被正确解释。网络字节顺序采用big endian排序方式。为了进行转换 bsd socket提供了转换的函数 有下面四个htons 把unsigned short类型从主机序转换到网络序htonl 把unsigned long类型从主机序转换到网络序n
转载
2015-08-26 10:14:20 ·
257 阅读 ·
0 评论