Boost Users :
Subject: Re: [Boost-users] asio ip::tcp::socket::read(), always returns end of file
From: Martin Dyring-Andersen (mda_at_[hidden])
Date: 2011-06-06 04:51:56
> I have an asio::ip::tcp::socket. Whenever I try to read from it, it
> throws an exception "end of file". But it is possible to write to the
> socket at any time! This is a client side application, it connects to
> the server using asio::async_connect(). The server is sending back the
> data, I checked it with wireshark. I tried using the both async_read()
> and read(), in both cases it fails with the same error. But both
> async_write(), and write() works perfectly. What could be the reason?
You don't provide a lot of information about the protocol, but the behavior you are seeing might be the server shutting down the servers' sending side of the connection, like
which still will leave the client able to write() data to the socket. The client should be able to read the data sent from the server before the shutdown() though.
Just an idea.
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