
Hi Dear all I want to handle socket close event in my connection, but I can't found mothed in ip::tcp::socket,How can I handle close event for socket? Thanks -- Best Regards, Yours Kennir

"Ken zhang"
I want to handle socket close event in my connection, but I can't found mothed in ip::tcp::socket,How can I handle close event for socket?
Hello Kennir, If you have an outstanding read request, when the socket is closed the read handler will be called with an error indication. In my own code I've seen these errors returned when a socket is closed: boost::system::errc::no_such_file_or_directory: boost::asio::error::shut_down: Hope this helps, ----Scott.

Hi Scott.
Thanks Scott. That's worked, but In my code, async_read returned
"boost::asio::error::eof" when a socket is closed.
Best Regards.
Yours Kennir
2008/11/16 Scott Gifford
"Ken zhang"
writes: I want to handle socket close event in my connection, but I can't found mothed in ip::tcp::socket,How can I handle close event for socket?
Hello Kennir,
If you have an outstanding read request, when the socket is closed the read handler will be called with an error indication. In my own code I've seen these errors returned when a socket is closed:
boost::system::errc::no_such_file_or_directory: boost::asio::error::shut_down:
Hope this helps,
----Scott. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Best Regards, Ken Zhang Greatelsoft Co., Ltd. mailto:ken@greatelsoft.com http://www.greatelsoft.com M/P:0086-1350-191-6596

"Ken zhang"
Hi Scott.
Thanks Scott. That's worked, but In my code, async_read returned "boost::asio::error::eof" when a socket is closed.
Thanks for the info Kennir, I'm sure it's just a random difference in our operating systems. I'll add that to my list of error codes that just mean the client closed the connection. ----Scott.
participants (2)
-
Ken zhang
-
Scott Gifford