Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

When/Why can recv() return 0

807578Aug 22 2001 — edited Sep 4 2001
I've been reading documents all morning, but I can't seem to find an answer to this one.

When and why can a blocking recv() return 0? (BTW, I'm using Forte 6 C++ Update 1 on Solaris 7 and 8).

Various UNIX programming FAQ's claim a blocking recv() returns 0 if the connection is closed indicating EOF. But this is not directly stated in the man pages for recv(). The way I read the man pages, is recv() would return -1 with an appropriate errno if the connection was closed. Furthermore, in my code where recv() is returning 0, it doesn't appear as if the connection is closed as a later call to recv() will get data.

So when recv() unblock's returning 0, do I need to retry, or should I catch the zero case?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 2 2001
Added on Aug 22 2001
2 comments
668 views