|
-
August 4th, 2012, 10:53 AM
#1
Interpreting return code of recv() socket api
Hi.
I have a situation where client waits on recv() on a socket in one thread. And , I am monitoring the same socket for timeout on another thread. When the timeout occurs , the second thread drops the socket.
As a result the first thread waiting on recv() gets a return code 0 (no bytes received ) with no error number set.
Now there is another case where recv() at client returns with 0 before the timeout , which is , when there is an issue with the server and it terminates the connection without sending any data.
Is the above behaviour of recv() in both cases correct ? If yes , is there a way at the client to differentiate between the two cases ? In both cases recv() returns with 0 and no error number.
Please let me know.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|