In the Internet address family, this structure is used by Windows Sockets to specify a local or remote endpoint address to which to connect a socket. This is the form of the sockaddr structure specific to the Internet address family and can be cast to sockaddr.
1 struct sockaddr_in
2 {
3 short sin_family; // (16位)地址家族(即指定地址格式),應為AF_INET。internetwork: UDP, TCP, etc.
4 unsigned short sin_port; // (16位)端口號
5 struct in_addr sin_addr // (32位) IP地址
6 char sin_zero[8]; // (64位) 填充,使結構體與SOCKADDR大小相同
7 }
8
9 總共為:128位(即16字節)
需要頭文件:winsock2.h
posted on 2012-07-12 16:28
canaan 閱讀(1219)
評論(0) 編輯 收藏 引用 所屬分類:
MSDN