Boost logo

Boost Users :

Subject: [Boost-users] asio ip::tcp::socket::read(), always returns end of file
From: Lloyd (lloydkl.tech_at_[hidden])
Date: 2011-06-06 04:10:10


Hi,

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?

This is how the read call implemented

...
....
boost::asio::streambuf b;
boost::asio::read(sock,b); //This line causes exception

...

Thanks,
  Lloyd


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