truct in_addr {
unsigned long s_addr; // that’s a 32-bit long, or 4 bytes
};
view plainprint?
struct sockaddr {
unsigned short sa_family; // address family, AF_xxx
char sa_data[14]; // 14 bytes of protocol address
};
view plainprint?
struct sockaddr_in {
short int sin_family; // Address family
unsigned short int sin_port; // Port number
struct in_addr sin_addr; // Internet address
unsigned char sin_zero[8]; // Same size as struct sockaddr
};
view plainprint?
#define h_addr h_addr_list[0] /*在h-addr-list中的第一個地址*/
view plainprint?
struct hostent {
char *h_name; /* 主機的官方域名 */
char **h_aliases; /* 一個以NULL結尾的主機別名數組 */
int h_addrtype; /* 返回的地址類型,在Internet環境下為AF-INET */
int h_length; /* 地址的字節長度 */
char **h_addr_list; /* 一個以0結尾的數組,包含該主機的所有地址*/