|
Boost Users : |
Subject: Re: [Boost-users] asio ip::tcp::socket::read(), always returns end of file
From: Igor R (boost.lists_at_[hidden])
Date: 2011-06-06 07:10:39
> Â Â Â Â Â Â Â Â Â Â Â Â boost::asio::read(sock,b);
> Â Â Â Â Â Â Â Â }
> Â Â Â Â Â Â Â Â catch(exception& e)
> Â Â Â Â Â Â Â Â {
> Â Â Â Â Â Â Â Â Â Â Â Â cout<<e.what()<<endl; //"This exception is thrown always-> "End of file"
> Â Â Â Â Â Â Â Â }
So your peer sends some data and closes the socket.
asio::read() reads this data, and then throws the exception. What
behavior would you expect?
Please note that this is the *only* way this overload can complete.
Otherwise, it would just block forever.
http://www.boost.org/doc/libs/1_46_1/doc/html/boost_asio/reference/read/overload4.html
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