Five Pitfalls of Linux Sockets Programming (developerWorks)
Posted Sep 21, 2005 14:38 UTC (Wed) by
RobSeace (subscriber, #4435)
In reply to:
Five Pitfalls of Linux Sockets Programming (developerWorks) by hppnq
Parent article:
Five Pitfalls of Linux Sockets Programming (developerWorks)
There is no other possible scenario where a return value of 0 could
occur (other than a passed-in length of 0), that I'm aware of... If
the socket is blocking, and there is no room in the queue for any more
data at all, then send()/write() will block... If the socket is
non-blocking, and there is no room in the queue for any more data at all,
then send()/write() will return -1 with errno set to EAGAIN... In all
other cases, there is room for at least 1 byte of data in the send queue,
and hence the return value will be at least 1... I can conceive of no
situation, short of passing in a length of 0, where send()/write() could
ever possibly return 0...
(
Log in to post comments)