You're using the readline operator <> to read your socket. This operator will, of course read _lines_ of input. The default line separator is \n. Your server code will read bytes until it sees a line end, just like it would if you were reading from a file. When you printed the "\n" to the socket, the server thought that the socket reading was over, and continued on. If you want to read bytes over newlines, you'll need to do a
local $/= (anything but\n)
inside your server to make sure that the server thinks that the end of the line is what you say it is whilst it it reading from the socket...
_______________________________________________
"Intelligence is a tool used achieve goals, however goals are not always chosen
wisely..."