in reply to Socket dilemma - sending EOF

I agree with rbc that you want to close the socket connection, but before you do that, try using something to flag the end of either the file or transmission. I've used both \02, \03 and \04 which are the hex equivalents of start of text, end of text and end of transmission. To look at these values just type man ascii in unix. Both the client and the server would have to use these as the transmission flags.