Boost logo

Boost Users :

Subject: Re: [Boost-users] [asio] Receiving data larger than buffer.
From: Sajjan Kalle (sairony_at_[hidden])
Date: 2009-11-24 12:33:48


2009/11/11 Igor R <boost.lists_at_[hidden]>:
>> 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_stream_socket/available.html
>

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.


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