AF_UNIX in windows

天大地大妈咪最大 提交于 2019-11-27 03:17:42

问题


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


回答1:


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.




回答2:


Update:

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

  • https://blogs.msdn.microsoft.com/commandline/2017/12/19/af_unix-comes-to-windows/
  • https://blogs.msdn.microsoft.com/commandline/2018/02/07/windowswsl-interop-with-af_unix/



回答3:


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.



来源:https://stackoverflow.com/questions/3872558/af-unix-in-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!