sockaddr_in sockaddr in_addr
struct sockaddr {
unsigned short sa_family; // address family, AF_xxx
char sa_data[14]; // 14 bytes of protocol address
};
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
};
struct in_addr {
unsigned long s_addr; // that’s a 32-bit long, or 4 bytes
};
想来你是要进行网络编程,使用socket, listen, bind等函数。
你只要记住,填值的时候使用sockaddr_in结构,而作为函数的
参数传入的时候转换成sockaddr结构就行了,毕竟都是16个字符
长。
struct sockaddr {
unsigned short sa_family; // address family, AF_xxx
char sa_data[14]; // 14 bytes of protocol address
};
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
};
struct in_addr {
unsigned long s_addr; // that’s a 32-bit long, or 4 bytes
};
想来你是要进行网络编程,使用socket, listen, bind等函数。
你只要记住,填值的时候使用sockaddr_in结构,而作为函数的
参数传入的时候转换成sockaddr结构就行了,毕竟都是16个字符
长。