Boost logo

Boost Users :

Subject: [Boost-users] Will asio::ip::tcp::socket::read let me read all my data even if remote end is connected?
From: Sean McAllister (smcallis_at_[hidden])
Date: 2010-03-22 00:35:10


Looking at the documentation for this function:
http://www.boost.org/doc/libs/1_37_0/doc/html/boost_asio/reference/basic_stream_socket/read_some/overload1.html

I'm not entirely clear whether it will do what I want. Basically I'm going
to be having a server send blocks of signal data (of unknown duration or
length).
I'd like the client to be able to read chunks of that until the remote end
closes. So right now my API has the user pass in a memory buffer to fill
along with a
size and I repeatedly call socket::read to fill it up. What I'm curious
about is if the server doesn't send a full block for the last block, and
then closes the connection.
Will this function still return whatever data it was able to read and then
throw an exception on the next read? Or will it throw an exception on that
last
read, rendering the last bit of data inaccesible?

Sean



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