Boost logo

Boost Users :

Subject: Re: [Boost-users] [Asio]What's the behavior of socket.async_write()after socket.close() is called?
From: Felipe Magno de Almeida (felipe.m.almeida_at_[hidden])
Date: 2010-06-07 06:30:12


Sorry to answer myself,

On Mon, Jun 7, 2010 at 7:26 AM, Felipe Magno de Almeida
<felipe.m.almeida_at_[hidden]> wrote:
> On Mon, Jun 7, 2010 at 7:17 AM, Igor R <boost.lists_at_[hidden]> wrote:
>>> You would destroy the socket. Delete'ing it,
>>
>> So it would be always necessary to store a ptr to a socket? Then
>> delete the socket, which was passed by reference to async_read()?
>> Doesn't sound good, does it?
>
> I see. You would call cancel first. Unfortunately cancelling is not
> very reliable. But cancelling is what is conceptually right here IMHO.

Also, the destructor guarantees to cancel any pending asynchronous
operation AFAIK. So it isn't a problem AFAIU. Unless you have
multithreading issues, which would be a problem with close as well.

[snip]

-- 
Felipe Magno de Almeida

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