Sincere apologies. I was very vague in my request. After looking at several examples on this forum, I have a sample script working with one-way communication but need help not only in sending data back to the server but to also convert these to daemons. BTW, here is my code:
Sender:
#!/usr/bin/perl
use IO::Socket::INET;
# Create a new socket
$MySocket=new IO::Socket::INET->new(PeerPort=>1234,Proto=>'udp',PeerAddr=>'3.24.141.91');
# Send actions
$def_action="Action: ";
print "\n",$def_action;
while($action=<STDIN>)
{
chomp $action;
if ($action ne '')
{
print "\n Action to be performed: '",$action,"'";
if($MySocket->send($action))
{
print ".....<done>","\n";
print $def_action;
}
}
else
{
# Send an empty action and exit
$MySocket->send('');
exit 1;
}
}
Receiver:
#!/usr/bin/perl
use IO::Socket::INET;
# Create a new socket
$MySocket=new IO::Socket::INET->new(LocalPort=>1234,Proto=>'udp');
$def_msg="\nReceived action.....\n";
print "\n",$def_msg;
while(1)
{
$MySocket->recv($action,128);
if ($action eq 'zonestats')
{
print "\nAction: $text\n";
print "Running ....\n\n";
$zonestats="/ztools/scripts/zonestat -l";
system($zonestats);
}
elsif ($action eq 'zonesize')
{
print "\nAction: $text\n";
print "Running zonesize....\n\n";
$zonesize="/ztools/scripts/zonesize -a";
system($zonesize);
}
# If action is empty, exit
else
{
print "No request made. Exiting\n";
exit 1;
}
}
Again, TIA.
Ajay