[ace-users] recv()

Leon Mergen leon at solatis.com
Tue Jul 10 13:51:33 CDT 2007


On 7/9/07, Albert Sanchez <ouferrat at gmail.com> wrote:
> How can I know after recv() how many bytes were actually received and if
> there's still something to receive??

If I'm not mistaken, you provide recv () with a pointer to the buffer
and the buffer size you want the fresh data to be stored in, and it
returns the amount of bytes.

The best way to see whether a socket still has data available is to
use a select ()-based event handling system, such as the Reactor. If
an event arrives on the socket, and you have read 0 or -1 bytes, you
know that the connection has been/should be closed.

I hope this helps.

-- 
Leon Mergen
http://www.solatis.com



More information about the Ace-users mailing list