perl example

I been looking for example on how to send commands with the IP interface. Had to do my own.

Here is a real simple perl example.You'll need to change the IP address to what you  are using




use IO::Socket::INET;

# flush after every write
$| = 1;

my ($socket,$client_socket);

# creating object interface of IO::Socket::INET modules which internally creates
# socket, binds and connects to the TCP server running on the specific port.
$socket = new IO::Socket::INET (
    PeerHost => '',
    PeerPort => '4998',
    Proto => 'tcp',
) or die "ERROR in Socket Creation : $!\n";

print "TCP Connection Success.\n";

# send iTach command getdevices
$data = "getdevices\r";
sleep (1);
print "Received from Server : $data\n";


print "socket closed\n";


Please sign in to leave a comment.