The line you are sending ends in a zero byte. When /sockread reads into %temp, it reads up to the first LF character. The next read starts at the zero byte in the stream and again reads up to the next LF character. And so on. You need to decide when sending the data whether you want it to be treated as binary or text and then make sure that the receiving /sockread acts accordingly.