On Mon, Jun 7, 2010 at 8:03 AM, Igor R
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.
Why is it more zombie, than a fresh "unopened" socket?
It is not. A open function is also bad. Two-phase construction is not well seen, and with reason. They loosen the classes invariant and make reasoning harder.
Also, the destructor guarantees to cancel any pending asynchronous operation AFAIK.
As far as I can see, it doesn't. shutdown() does.
IIRC, the destructor calls shutdown. But I can't see any documentation for tcp::socket destructor. Maybe Christopher could shed us some light in this. I hope it is just an overlook. Obligating everybody to call shutdown before destroying a socket with pending asynchronous operations seems dangerous to me. Regards, -- Felipe Magno de Almeida