Boost logo

Boost Users :

Subject: [Boost-users] asio: take back ownership of native descriptor
From: Koen Deforche (koen_at_[hidden])
Date: 2009-02-23 05:38:41


Dear all,

We have been enjoying using asio alot to build cross-platform
networking applications.

Just recently, however, we have encountered a limitation that seems
impossible to work around, and, would only require a small addition in
the API to accomodate.

We are trying to add one or more native socket descriptors into asio's
reactor to be informed when it is possible to write or read from these
descriptors.

Therefore, we are creating a tcp::socket and assign() to it a native
descriptor. This works, but it seems that nothing can prevent asio
from closing the connection in ~tcp::socket() (which does not seem
logic since asio did not open the connection in the first place).
Should there not be a method to 'take' (back) the descriptor from the
asio socket, which resets the socket to the same state as its default
constructor ?

We tried the workaround that was suggested on the mailinglist, which
is to dup() the descriptor. This works on Linux. Unfortunately, dup()
is not available on Windows platforms, and when trying to workaround
this by using Windows' native methods, we hit the same (so far,
unsolved?) problem of this post:

http://thread.gmane.org/gmane.comp.lib.boost.user/44269

Regards,
koen


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net