There is a function assign in Boost.Asio sockets, however I’m looking for something like
- release/unassign that would transfer the ownership on socket back to user.
or
- some type of assign that would not transfer ownership to socket class, so it would not close it when destroyed.
I’m aware of this solution but it involves duplicating socket (i.e. creating new descriptor rather then releasing one).
Does anybody knows how can this be done?
Edit: There is no such feature, opened ticket for Boost.Asio https://svn.boost.org/trac/boost/ticket/3900
I couldn’t find any such way in the .hpp files (Boost 1.35), so I think you’ll have to patch ASIO yourself and add a
release()method. When done, you could keep the patch for yourself, post it on your website (or here), or submit it back to Boost.Do try the Boost mailing lists. The people there might tell you whether such a method is a good or bad idea, and why. If you find anything interesting there, please post a summary here.
BTW: Boost 1.42 was released yesterday.