Under Linux, can recv ever return 0 on UDP?

udp doesn't have the concept of a connection so can it return 0? and if it can, what is it's meaning

It means a 0-length datagram was received. From the great UNP:

Writing a datagram of length 0 is acceptable. In the case of UDP, this results in an IP datagram containing an IP header (normally 20 bytes for IPv4 and 40 bytes for IPv6), an 8-byte UDP header, and no data. This also means that a return value of 0 from recvfrom is acceptable for a datagram protocol: It does not mean that the peer has closed the connection, as does a return value of 0 from read on a TCP socket. Since UDP is connectionless, there is no such thing as closing a UDP connection.

Tags:

Linux

C

Udp