Can we create an additional socket with an already open socket?

I have code that creates a socket for me through stunServer for my peer-to-peer software, and I wonder if it is possible to create boost :: udp :: socket with an already open socketer?

I have already searched the documentation for enhancement, but I have not found anything that would resolve this.

+4
source share
1 answer

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 details.

+6
source

All Articles