I don't currently have the ability to try to run this code, but the first thing that pops out when you're talking about Linux vs Windows is the newline characters. I see you are using \r\n, which should be correct for Windows, but that makes me wonder whether or not you made any changes for the Linux version to work? I don't know offhand what \r does in a unix environment.
What troubleshooting have you done in that arena? Do you have any debug information? Also, try removing the \n from the print $sock statement in your client. I've had issues where my socket would only send the first line (which was blank in my case) and then exit.
Just some thoughts... when I get to my workstation I'll try to run the code to see how it works.