我已经尝试使用 Windows 套接字 API 进行 AF_UNIX,如下所示:
socket(AF_UNIX, SOCK_STREAM, 0);
以上调用返回了INVALID_SOCKET
。最后的错误是:
10047 "An address incompatible with the requested protocol was used".
当我尝试使用 Windows 中可用的其他套接字“类型”值(例如 SOCK_DGRAM
和 SOCK_RAW
)时,结果是相同的。
所以我的问题是:有没有办法利用'Winsock2'中定义的AF_UNIX,以便在Windows中实现类似于UNIX中的功能?
最佳答案
documentation on MSDN for the socket function说:
The values currently supported are AF_INET or AF_INET6, which are the Internet address family formats for IPv4 and IPv6. Other options for address family (AF_NETBIOS for use with NetBIOS, for example) are supported if a Windows Sockets service provider for the address family is installed.
因此,除非您安装了第三方服务提供商,否则无法使用AF_UNIX
。
关于windows - 我可以通过什么方式在Windows中使用Winsock2中定义的AF_UNIX,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16418798/