Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AF_UNIX in windows

I have an application that I wish to use over windows. I am using AF_UNIX family un windows. I wish to know that AF_UNIX family is available in windows. If not then is there any alternate to AF_UNIX ?

Thanks Arpit

like image 793
Arpit Avatar asked Oct 06 '10 12:10

Arpit


People also ask

Do Unix sockets work on Windows?

Unix sockets allow inter-process communication (IPC) between processes on the same machine. In practice that means that all recent builds of Windows 10 support Unix sockets, plus Windows 11, of course.

What is AF_UNIX?

The AF_UNIX (also known as AF_LOCAL) socket family is used to communicate between processes on the same machine efficiently. Traditionally, UNIX domain sockets can be either unnamed, or bound to a filesystem pathname (marked as being of type socket).

How do I use a domain socket in UNIX?

To create a UNIX domain socket, use the socket function and specify AF_UNIX as the domain for the socket. The z/TPF system supports a maximum number of 16,383 active UNIX domain sockets at any time. After a UNIX domain socket is created, you must bind the socket to a unique file path by using the bind function.


1 Answers

Edit: since about 2018, Windows 10 supports AF_UNIX.

https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/

Old answer:

Just use TCP sockets, they behave very much like UNIX sockets.

Or you can use named pipes and use WaitForMultipleObjects() instead of select() or poll(). Windows named pipes are not quite like named pipes in UNIX. Windows named pipes are bi-directional and thus more like AF_UNIX sockets than named pipes in UNIX.

like image 169
Prof. Falken Avatar answered Sep 23 '22 01:09

Prof. Falken