#!/usr/bin/perl -w
use IO::Socket;
my $sock = new IO::Socket::INET (
PeerAddr => 'remotehost',
PeerPort => '1230',
Proto => 'tcp',
) or die "ERROR in Socket Creation : $!\n";
print "TCP Connection Success.\n";
# write on the socket to server.
$data = "this is the data to send";
$socket->send($data);
# read the socket data sent by server.
$data = <$socket>;
print "Received from Server : $data\n";
sleep(10);
close($sock);
I am unable to send and receive response from the remotehost using the above code...any ideas?
Thanks Ashish