While attempting to port filesystem to Windows Phone 8.1, I encountered some issues with the WinRT portions of ASIO. Examining the Boost code shows that ASIO does not fully support WinRT. Examples are that the acceptor implementation for WinRT #includes the null_socket_service class in socket_acceptor_service.hpp, rendering it unsupported. In addition, there is no counterpart in WinRT to WinSock's select() function, so there is no way to call select() off of a WinRT socket object.
I would therefore like to briefly summarize what my company's needs are, what problems I've encountered, and a suggested solution for having ASIO support WinRT.
Here are our corporate library's (let's call it CORLIB) needs:
(*) Our goal is to build our Boost-based library (i.e., CORLIB) for Windows Phone 8.1.
(*) CORLIB refers to Boost sockets in a cross-platform fashion (e.g., using the basic_stream_socket class as an abstraction via boost::asio::ip::tcp::socket).
(*) CORLIB uses the boost::asio::ip::tcp::acceptor object in portions of its code.
(*) CORLIB also calls the bind() socket function
(*) CORLIB uses the BSD/Winsock functions select() and bind(), among other functions, to implement its logic
Here are the problems:
(*) The socket_acceptor_service class #includes null_socket_service.hpp to implement the acceptor object for WinRT. In other words, the acceptor object is not implemented for WinRT.
(*) The winrt_ssocket_service_base class does not implement the listen() function, something that must be implemented to support the acceptor object.
(*) The winrt_ssocket_service class implements native_handle_type as Windows::Networking::Sockets::StreamSocket^. There is no WinRT analog for the BSD/WinSock select() function, so CORLIB has no way of performing a select on the StreamSocket object. Since select() is critical to CORLIB, StreamSocket^ is unacceptable.
We believe that winrt_ssocket_service must be implemented using WinSock (almost completely supported by Windows Phone 8.1) rather than Windows::Networking::Sockets, because the select() function is unimplementable using the WinRT hierarchy.
We therefore propose creating a new socket service class for WinRT (we will refer to this new service class as winrt_winsock_socket_service) . This new service will be similar to reactive_socket_service: the stream_socket_service.hpp include file shows the following:
#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
# include