boost::asio and socket ownership

Posted by vedro so snegom on Stack Overflow See other posts from Stack Overflow or by vedro so snegom
Published on 2010-06-03T13:23:30Z Indexed on 2010/06/03 13:24 UTC
Read the original article Hit count: 215

Filed under:
|
|
|

Hello

I've two classes (Negotiator, Client), both has their own boost::asio::ip::tcp::socket. Is there a way to transfer socket object to Client after negotiation is finished. I'm looking forward to do something like that:

 boost::asio::ip::tcp::socket sock1(io);
 //...
 boost::asio::ip::tcp::socket sock2;
 sock2.assign(sock1); 

This operation must guarantee that the connection won't be closed when sock1 is destroyed.

© Stack Overflow or respective owner

Related posts about c++

Related posts about boost