![]() ![]() |
|
C++字节顺序(bigendian&littleendian) | |
作者:佚名 文章来源:不详 点击数 更新时间:2008/10/22 21:34:01 文章录入:杜斌 责任编辑:杜斌 | |
|
|
在计算机中存储IP地址和端口号是按照主机字节(host byte)表示的。考试大,但是在网络上指定IP地址和端口号,是按照网络字节(network byte)来表示的(就是big endian)。 u_long htonl(u_long hostlong) 主机字节转换为网络字节,32比特整数 u_short htons(u_short hostshort)主机字节转换为网络字节,16比特整数 u_long ntohl(u_long netlong)网络字节转换为主机字节,32比特整数 u_short ntohs(u_short netshort) 网络字节转换为主机字节,16比特整数来源:考试大 |
|
![]() ![]() |