Re: [asio-users] sockets and handlers
Brought to you by:
chris_kohlhoff
From: Christopher K. <ch...@ko...> - 2007-09-21 11:54:20
|
On Fri, 21 Sep 2007 10:35:51 +0800, "Cheng Lian" <rhy...@gm...> said: > You can check the error_code passed into your handlers: > > if( error != boost::asio::error::operation_aborted ) { > perform_next_connection(); > } Yes, but with composed operations (such as asio::async_read) you may also get bad_descriptor if you just happened to close the socket in between two individual async_read_some operations. It may be better to write something like: if (sock.is_open() && error) ... I.e. if sock.is_open() returns false then it's because you have explicitly closed the socket. Cheers, Chris |