Jeroen
Jeroen

Reputation: 16865

Can I use Local Sockets on a Windows Operating System? - C++ / Boost

Can I create a boost::asio::local::stream_protocol::socket on a Windows Operating System? I know it is supposed to be a 'UNIX' socket, but does Windows not support this?

Upvotes: 2

Views: 2105

Answers (2)

user7116
user7116

Reputation: 64118

From the boost docs, you can test for BOOST_ASIO_HAS_LOCAL_SOCKETS to determine if they are supported on your local operating system. Considering AF_UNIX is not supported on Windows, it would seem likely that this definition is not available under your standard Windows environment.

Upvotes: 2

nikolas
nikolas

Reputation: 8975

If I understood that correctly, boost::asio::local::stream_protocol is POSIX specific. Windows itself is no POSIX conform environment, but there are POSIX enviroments for Windows out there, namely Cygwin. But you will not be able to distribute these applications without distributing the environment as well.

In some cases, especially when Unix is your primary target platform, and you are offering a Windows version out of generosity, this may be acceptable.

Otherwise you should think about ways of getting around the functionalities which are explicitly marked as non-portable.

Upvotes: 3

Related Questions