Quote:
Originally Posted by climbnorth
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.