why would a socket read() set errno to EWOULDBLOCK but still read?

mlevin at jade.tufts.edu mlevin at jade.tufts.edu
Fri Jun 28 08:07:01 AEST 1991


   I am doing a read() on a connected TCP socket (BSD 4.3) marked as
non-blocking. For some reason, the read returns the proper number of
characters read (or sometimes 0), but sets errno to EWOULDBLOCK. Why
is this? My program never did this before; I was under the impression
that if no data was available, it should return -1. Is this a possible
event, or am I trashing memory somewhere? Please reply to
mlevin at jade.tufts.edu. 

Mike Levin



More information about the Comp.unix.programmer mailing list