Reputation: 575
I have tried AF_UNIX with Windows socket API as follows:
socket(AF_UNIX, SOCK_STREAM, 0);
Above call returned INVALID_SOCKET
. Last error was:
10047 "An address incompatible with the requested protocol was used".
The results were same when i tried the same with other socket 'type' values available in Windows like SOCK_DGRAM
and SOCK_RAW
.
So my question is: Is there any way to make use of AF_UNIX defined in 'Winsock2', so that its functionality similar to that in UNIX can be achieved here in Windows?
Upvotes: 3
Views: 734
Reputation: 326
I know this post is old, but in 2017 AF_UNIX was added to Windows 10! (I believe it was because of the WSL, but that's just my speculation).
But in summary, you'll need to use the #include <afunix.h>
header.
For more information:
The unix socket (AF_UNIX) function in Windows
Upvotes: 2
Reputation: 36348
The documentation on MSDN for the socket function says:
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.
So, unless you have installed a third-party service provider, you cannot use AF_UNIX
.
Upvotes: 3