Skip to contentSkip to conversation

EOF and zero-length packets?

DISCUSSION Rémi Denis-Courmont 1 participant 1 message Dec 2, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello,

When dealing with SOCK_STREAM sockets, a zero read means the other side has shut down the connection, and there will be no more incoming data.

When dealing with SOCK_DGRAM/SOCK_RAW sockets, a zero read means we got an empty packet, and we should keep on reading.

What about SOCK_DCCP? It seems both scenarios yield zero, which is, hmm, problematic from userland. Is checking for POLLHUP in revents the recommended disambiguation? that seems a bit backward to me :(

Signature · 2 lines
Rémi Denis-Courmont
http://www.remlab.net/