Boost logo

Boost Users :

From: River Tarnell (river_at_[hidden])
Date: 2008-07-07 10:56:25


Igor R:
> > the actual problem is this: sometimes, after a socket is deleted, instead of
> > oustanding read/write operations returning with asio::error::operation_aborted,
> > they return with no error (error==0), but with socket.native() equal to -1.
 
> Those operations probably had completed *just before* you closed the socket...

so, if i understand correctly, there are pending calls for these events on the
io_service queue, and when the socket is deleted, these calls are not removed?

if so, how do i fix this? or more generally: how can i safely release an
object holding a socket while there may be outstanding i/o operations? i've
looked through the asio documentation, but i don't see anything about this in
the tutorial or the example programs. i had assumed that socket::cancel() was
the right solution to this, but it seems this is not the case...

        - river.


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