Boost logo

Boost Users :

Subject: Re: [Boost-users] [Asio]What's the behavior of socket.async_write()after socket.close() is called?
From: Dmytro Ovdiienko (dmitriy.ovdienko_at_[hidden])
Date: 2010-11-05 08:32:30


Felipe,

I guess it is MUST be mode/state in the socket when all pending recv
operations are canceled and new recv calls are rejected BUT socket handle is
still alive. Using this mode user can safely shutdown incoming data
processing. Otherwise user should lock socket before call
async_read/close/async_write.

On 7 June 2010 13:26, 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.
>
> >> or using a boost::optional.
> >
> > But it's not optional, according to its semantics...
>
> It seems to me. If you call close you want the socket released. That a
> zombie socket remains is a design problem. Zombie objects should be
> avoided.
> I don't think it can be implementable without unnecessary overhead though.
>
> Regards,
> --
> Felipe Magno de Almeida
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

-- 
Dmytro Ovdiienko
e-mail: dmitriy.ovdienko_at_[hidden]
skype: dmitriy.ovdienko_at_[hidden]
mobile: +38050-1909731


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