Ah, the joys of socket programming. You've caused a deadlock
situation. The
makes that your program
is waiting for input (it's going to suck up all the input
until eof, which in this case means, the socket closing).
But the other end is also waiting for input, and it's not
going to talk until it sees something. Your program is only
going to finish if the other ends break the deadlock because
some timer goes off.