20

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

icedwater
  • 4,701
  • 3
  • 35
  • 50
Arpit
  • 4,259
  • 10
  • 38
  • 43
  • 2
    I'm not 100% sure what AF_UNIX is for, but if its for interprocess comms, Windows can do efficient interprocess comms using AF_INET sockets bound to localhost. In this case windows does detect that the socket is pointing to another local process and shortcuts the comms stack, using LRPC to do the data transfer (That uses memory mapped files for a zero copy move of the buffer between processes). – Chris Becke Oct 06 '10 at 14:16

3 Answers3

18

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.

Prof. Falken
  • 24,226
  • 19
  • 100
  • 173
10

Update:

Windows 10 now finally supports this ever since the Windows 10 April 2018 update was released:

ExE Boss
  • 126
  • 1
  • 4
  • Rather than link to external resources, please post excerpts from these resources that answer the question. – chb Aug 24 '18 at 21:35
  • 1
    AF_UNIX support is broken in that very old Windows 10 version (1803). Upgrading Windows helps. – E. van Putten Sep 22 '21 at 17:14
0

Windows does not support Unix domain sockets, nor does it provide a good alternative that uses the socket API. You should use TCP sockets on Windows - bind the server to localhost if you want something similar to AF_UNIX sockets. Depending on your problem, the overhead of TCP is negligible.

AndiDog
  • 68,631
  • 21
  • 159
  • 205