#!/usr/bin/perl -w use IO::Socket::INET; my $sock = new IO::Socket::INET (Blocking => 1, PeerAddr => 'localhost', PeerPort => '20205', Proto => 'tcp'); my $clean_content = ""; die "Could not create socket: $!\n" unless $sock; $sock->autoflush(1); $|=1; $sock->send("message to server\r\n"); while (<$sock>) { print $_; } close $sock;