[asio] Receiving data larger than buffer.

Hi, I have a few questions regarding asio, and the network sockets in particular. I'm using TCP sockets to transfer data across a network. The problem I have is when data that is larger than the receive buffer. In this case num bytes reported == receive buffer size, however, is there a way to distinguish the case when I receive exactly buffer size amounts of data, and when the case when there's more left to complete the transfer? How does asio handle transfer of really large buffers? Will it dispatch it client side in receive buffer sized chunks as it enters, or will it wait for the entire payload to enter some internal buffer before dispatching?

however, is there a way to distinguish the case when I receive exactly buffer size amounts of data, and when the case when there's more left to complete the transfer?
You can use socket::available() http://www.boost.org/doc/libs/1_40_0/doc/html/boost_asio/reference/basic_str...
How does asio handle transfer of really large buffers? Will it dispatch it client side in receive buffer sized chunks as it enters, or will it wait for the entire payload to enter some internal buffer before dispatching?
IIRC, the current implementation of ASIO (at least in windows) just supplies your buffer(s) to the OS API that performs the actual i/o, so no additional copying occurs.

2009/11/11 Igor R
however, is there a way to distinguish the case when I receive exactly buffer size amounts of data, and when the case when there's more left to complete the transfer?
You can use socket::available() http://www.boost.org/doc/libs/1_40_0/doc/html/boost_asio/reference/basic_str...
I've encountered cases where socket::available() > 0 but the number of bytes transfered is less than the size in the buffer. I presume this means that more data has been sent on the socket, but as a part of another send operation, which sadly brings me back to the original problem. Is there a clean way to differentiate between the case where the send operation just happened to be exactly the same amount of bytes as the buffer, and there's nothing left for that particular transfer but still more data available on the socket, and the case where there's more data available on the socket but it being part of the same send operation.
participants (2)
-
Igor R
-
Sajjan Kalle