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 阅读(1200)
评论(0) 编辑 收藏 引用 所属分类:
MSDN