有谁知道是否可以在 C (AF_UNIX) 中将 getaddrinfo 与 unix 套接字一起使用。我尝试了一些方法,但无法使其发挥作用。这基本上就是我正在尝试的:
struct addrinfo hints, *res;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNIX;
hints.ai_socktype = SOCK_STREAM;
if(getaddrinfo("What should I put here?", "What should I put here?", &hints, &res) != 0){
//do sth about
}
Run Code Online (Sandbox Code Playgroud)
我的问题是如何填充节点和服务字段,以防可以将其与 unix 套接字一起使用。
提前致谢。