
m_addr.sin_port = htons(m_uPort);
将主机的无符号短整形数转睁汪换成网络字节顺序。
#include
u_short PASCAL FAR htons( u_short hostshort);
hostshort:主机字节顺序表达的16位数。
注释:
本函数将一个16位数从主机字节顺序转换成燃早巧网络字节顺序。
返皮键回值:
htons()返回一个网络字节顺序的值。
The htons function converts a u_short from host to TCP/IP network byte order (which is big-endian).
u_short htons(
u_short hostshort
);
Parameters
hostshort
[in] 16-bit number in host byte order.
Return Values
The htons function returns the value in TCP/IP network byte order.
Remarks
The htons function takes a 16-bit number in host byte order and returns a 16-bit number in network byte order used in TCP/IP networks.