Can we create boost socket with a socket already open?

boost, boost-asio, c++, sockets

Solution

Yes.

io_service ios;
ip::udp::socket socket(ios);
int native_socket = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
socket1.assign(ip::udp::v4(), native_socket);

See this sample code for more.

Problem

I have a code that create me a socket throught a stunServer for my peer to peer software and I'm wondering if it's possible to create a boost::udp::socket with a socket already open ? I have already search in the boost documentation but i found nothing that permited this .

Original source