Im very new to perl so still learning.
My aim is to have a script which checks a server for a flag to change and when it finds the change fire off a script I have in php.
The server is on a phone switch so I query a chanel and it give a responce eg:
it then says
ch1, Y, 01:23, 4402, 01xxxxxxxxx
(which is the chanel, flag, call duration, extension which has siezed the chanel and the destination)
So the script I have so far is:
#! /usr/bin/perl -w
my($remote_host, $remote_port, $response, $socket);
$remote_host = "10.2.101.20";
$remote_port = 343;
print "IPO Checker\nConnecting\n";
$socket = IO::Socket::INET->new(PeerAddr => $remote_host,
PeerPort => $remote_port,
Proto => "tcp",
Type => SOCK_STREAM)
or die "Couldn't connect to $remote_host:$remote_port : $@\n";
print $socket "ch1";
$response = <$socket>;
# and terminate the connection when we're done
Ultimately I will loop the check etc but first I would like to get a single check working (baby steps here
The above I have hacked around from various tutorials and the bit im struggling with is sending and recieving the responce from the server.