#! /usr/bin/perl -w use IO::Socket::INET; use IO::Socket::Timeout; use Errno qw(ETIMEDOUT EWOULDBLOCK); # flush after every write $| = 1; my $socket; $socket = new IO::Socket::INET ( PeerHost => '192.168.0.50', PeerPort => '3629', Proto => 'tcp', Timeout => 2, ); print "TCP Connection Success..."; print "Try to send...."; print $socket 0x45, 0x53, 0x43, 0x2f, 0x56, 0x50, 0x2e, 0x6e, 0x65, 0x74, 0x10, 0x03, 0x00, 0x00, 0x00, 0x00, 0x50, 0x57, 0x52, 0x3f, 0x0D; print "sended!\n"; print "Try to read...."; print "Received from Server : "; print <$socket>; $socket->close(); print "Socket closed.\n"; print "End.\n";