Thread: Web Client
View Single Post
Old Oct 3rd, 2006, 11:18 AM   #4
sarumont
Hobbyist Programmer
 
sarumont's Avatar
 
Join Date: Apr 2004
Location: /dev/urandom
Posts: 154
Rep Power: 5 sarumont is on a distinguished road
Send a message via ICQ to sarumont Send a message via AIM to sarumont Send a message via Yahoo to sarumont
Quote:
Originally Posted by climbnorth View Post
Look at this page for using recv, should help:

http://www.opengroup.org/onlinepubs/...ions/recv.html

Realize that recv returns a value. That value is how many bytes were read.
So read until it stops receiving bytes. Remember, it returns negative if there was an error, so handle that too.
OP does have it only reading 1024 bytes at a time, but that can still be problematic for this reason. I would concur with climbnorth's suggestion of threading the recv(); alternatively, OP could use select() rather than recv() to set a timeout on the read.
__________________
"Time is an illusion. Lunchtime doubly so."
-the late, great Douglas Adams
sarumont is offline   Reply With Quote