For a TCP socket, I would expect it to return eof, since that is how TCP
sockets work.
read() and recv() return 0 as the number of bytes read when the socket is
shutdown for reading. AFAIK, that's the only way to determine that state
from the socket API.