in reply to socket communication

Why are you calling
shutdown($socket, 1);
between ->send calls ?

shutdown tells the server not to read any more.

        What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?
              -Larry Wall, 1992