2、AF_INET、SOCK_STREAM 是2个整型参数,其中:
AF_INET:IPV4 internet协议
SOCK_STREAM:面向连接的全双工字节流通信
addr属于:#include<netdb.h>
struct addrinfo
{
int ai_flags
int ai_family//AF_INET,AF_INET6,UNIX etc
int ai_socktype//STREAM,DATAGRAM,RAW
int ai_protocol//IPPROTO_IP, IPPROTO_IPV4, IPPROTO_IPV6 etc
size_t ai_addrlen//length of ai_addr
char* ai_canonname//full hostname
struct sockaddr* ai_addr//addr of host
struct addrinfo* ai_next
}
value of ai_falgs:
AI_PASSIVE: Socket address is intended for `bind'.
AI_CANONNAME:Request for canonical name.
AI_NUMERICHOST: Don't use name resolution.
AI_V4MAPPED: IPv4 mapped addresses are acceptable.
AI_ALL: Return IPv4 mapped and IPv6 addresses.
AI_ADDRCONFIG:Use configuration of this host to choose
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)