标签:
1
2
3
4
5
6
7
8
9
10
11
12
13
|
struct sockaddr_in { short sin_family; /*Address family一般来说AF_INET(地址族)PF_INET(协议族)*/ unsigned short sin_port; /*Port number(必须要采用网络数据格式,普通数字可以用htons()函数转换成网络数据格式的数字)*/ struct in_addr sin_addr; /*IP address in network byte order(Internet address)*/ unsigned char sin_zero[8]; /*Same size as struct sockaddr没有实际意义,只是为了 跟SOCKADDR结构在内存中对齐*/ }; |
1
2
3
4
5
6
7
8
9
10
11
|
struct sockaddr_in { # if (_WIN32_WINNT<0x0600) short sin_family; # else //(_WIN32_WINNT<0x0600) address_family sin_family; #endif //(_WIN32_WINNT<0x0600) ushort sin_port; in_addr sin_addr; char sin_zero[8]; } |
1
2
3
4
5
6
|
struct sockaddr_in { short sin_family; u_short sin_port; struct in_addr sin_addr; char sin_zero[8]; }; |
1
2
3
4
5
|
typedef uint32_t in_addr_t; struct in_addr { in_addr_t s_addr; }; |
1
2
3
4
5
6
7
8
|
typedef struct in_addr { union { struct { unsigned char s_b1,s_b2,s_b3,s_b4; } S_un_b; struct { unsigned short s_w1,s_w2; } S_un_w; unsigned long S_addr; }S_un; }in_addr; |
标签:
原文地址:http://www.cnblogs.com/ranjiewen/p/5617987.html