recv() returning 0 and EINTR on a still connection.

M. Warner Losh imp at bsdimp.com
Thu Apr 24 23:58:24 PDT 2003


In message: <Pine.SO4.4.05.10304250110450.18123-100000 at cougar.isg.siue.edu>
            William Michael Grim <wgrim at siue.edu> writes:
: I think your problem is that n==0 does NOT mean the connection was closed
: (at least not with TCP; I haven't really looked into other session
: protocols).

I know that it does with FreeBSD, at least for read(2).

: If n==0, it only means you have stopped receiving data because there is no
: more to be received; you can only trust errno if n==-1 or whatever the man
: page specifies for your OS (FreeBSD is -1 in this case).

FreeBSD returns -1 and EWOULDBLOCK in this case.

Warner


More information about the freebsd-hackers mailing list