When you call the Ruby function IO#eof?, the question you expect to have answered is: have I sucked all available data from this file/stream/whatever?, right?
Well... based on observed behavior yesterday (a bit hard to be perfectly sure what's happening, given that it's dynamic), TCPSocket#eof? answers the question: has the remote host sent FIN?, which isn't exactly the same thing, given that there may still be a large amount of buffered, not-yet-read data.
This doesn't really affect the immediate application, which involves the remote host sending data more or less indefinitely, but when I tested with
dd if=/dev/urandom of=- bs=512 count=5 | nc localhost 1642
the Ruby script acting as server for port 1642 received the connection, but then saw eof? go true right at the beginning of the while (!socket.eof?) loop, before processing any data. This is unhelpful.
Comments