getaddrinfo,AF_UNIX
有没有ai_family设置为 AF_UNIX;
然后用getaddrinfo获取地址的例子给发下呗
------解决方案--------------------
不支持噢,你要知道这个函数是操作DNS的,UNIX-DOMAIN-SOCKET与网络有关吗?无关.
ai_family This field specifies the desired address family for the returned addresses. Valid values for this field include AF_INET and AF_INET6. The
value AF_UNSPEC indicates that getaddrinfo() should return socket addresses for any address family (either IPv4 or IPv6, for example) that
can be used with node and service.
UNIX SOCKET很简单,客户端直接connect服务端(一般主动bind在一个地址,由内核指定的话不太好控制),服务端则必须bind在一个给定的path进行监听。
想知道怎么用,要学会用manpage:man 7 unix
------解决方案--------------------直接拼不行吗
就两个成员
addr.sa_family = AF_UNIX;
strcpy(addr.sa_data, "/tmp/abc");