U
usaims
Hello:
I am writing a program that will check to see if a certain port, in a
sequence of servers, is open and if it is, it will send a proprietary
command to that listening socket to send data back to output. And if
the port is not open, it will send a error message. I do know for a
fact that when I test this script, the port is open but I"m getting
errors that it isn't and an indication that that the port is open. I"m
sure my issue is with my loop, sorry for the newbie question, any clue?
TIA
-bash-3.00# ./test1.pl
10.173.193.1 -> Not accepting connections, please try again later.
10.173.193.1 -> Not accepting connections, please try again later.
10.173.193.1 -> 2463030335
10.173.193.1 -> Not accepting connections, please try again later.
10.173.193.1 -> Not accepting connections, please try again later.
10.173.193.1 -> Not accepting connections, please try again later.
10.173.193.2 -> Not accepting connections, please try again later.
10.173.193.2 -> Not accepting connections, please try again later.
10.173.193.2 -> 2463030335
10.173.193.2 -> Not accepting connections, please try again later.
10.173.193.2 -> Not accepting connections, please try again later.
10.173.193.2 -> Not accepting connections, please try again later.
10.173.193.3 -> Not accepting connections, please try again later.
10.173.193.3 -> Not accepting connections, please try again later.
10.173.193.3 -> 2463030335
10.173.193.3 -> Not accepting connections, please try again later.
10.173.193.3 -> Not accepting connections, please try again later.
10.173.193.3 -> Not accepting connections, please try again later.
10.173.193.4 -> Not accepting connections, please try again later.
10.173.193.4 -> Not accepting connections, please try again later.
10.173.193.4 -> 2463030335
10.173.193.4 -> Not accepting connections, please try again later.
10.173.193.4 -> Not accepting connections, please try again later.
10.173.193.4 -> Not accepting connections, please try again later.
#########################
#!/usr/bin/perl
use warnings;
use strict;
use warnings;
use IO::Socket::INET;
ROXIE: foreach my $x (1..8) {
my $host_ip = '10.173.193.';
SOCKET: if (IO::Socket::INET->new(PeerAddr => "$host_ip$x",
PeerPort => '9876',
Proto => 'tcp',
)
)
{
#my @stuff = `/roxie/testsocket $host_ip$x:9876
\"<control:soapversion/>\"`;
open(NUMFILES, "/roxie/testsocket $host_ip$x:9876
\"<control:soapversion/>\" |");
my @data = <NUMFILES>;
foreach my $stuff(@data) {
if ($stuff =~ m/^<Endpoint
ep='([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/i) {
$main::dog = $1;
#print $main::dogshit;
}
## capturing the soapversion ###
if ($stuff =~
m/^<SoapVersion>([0-9]+)/i) {
my $cat = $1;
print "$main::dog -> $cat\n";
}
else
{
print "$host_ip$x -> Not accepting
connections, please try again later.\n";
}
I am writing a program that will check to see if a certain port, in a
sequence of servers, is open and if it is, it will send a proprietary
command to that listening socket to send data back to output. And if
the port is not open, it will send a error message. I do know for a
fact that when I test this script, the port is open but I"m getting
errors that it isn't and an indication that that the port is open. I"m
sure my issue is with my loop, sorry for the newbie question, any clue?
TIA
-bash-3.00# ./test1.pl
10.173.193.1 -> Not accepting connections, please try again later.
10.173.193.1 -> Not accepting connections, please try again later.
10.173.193.1 -> 2463030335
10.173.193.1 -> Not accepting connections, please try again later.
10.173.193.1 -> Not accepting connections, please try again later.
10.173.193.1 -> Not accepting connections, please try again later.
10.173.193.2 -> Not accepting connections, please try again later.
10.173.193.2 -> Not accepting connections, please try again later.
10.173.193.2 -> 2463030335
10.173.193.2 -> Not accepting connections, please try again later.
10.173.193.2 -> Not accepting connections, please try again later.
10.173.193.2 -> Not accepting connections, please try again later.
10.173.193.3 -> Not accepting connections, please try again later.
10.173.193.3 -> Not accepting connections, please try again later.
10.173.193.3 -> 2463030335
10.173.193.3 -> Not accepting connections, please try again later.
10.173.193.3 -> Not accepting connections, please try again later.
10.173.193.3 -> Not accepting connections, please try again later.
10.173.193.4 -> Not accepting connections, please try again later.
10.173.193.4 -> Not accepting connections, please try again later.
10.173.193.4 -> 2463030335
10.173.193.4 -> Not accepting connections, please try again later.
10.173.193.4 -> Not accepting connections, please try again later.
10.173.193.4 -> Not accepting connections, please try again later.
#########################
#!/usr/bin/perl
use warnings;
use strict;
use warnings;
use IO::Socket::INET;
ROXIE: foreach my $x (1..8) {
my $host_ip = '10.173.193.';
SOCKET: if (IO::Socket::INET->new(PeerAddr => "$host_ip$x",
PeerPort => '9876',
Proto => 'tcp',
)
)
{
#my @stuff = `/roxie/testsocket $host_ip$x:9876
\"<control:soapversion/>\"`;
open(NUMFILES, "/roxie/testsocket $host_ip$x:9876
\"<control:soapversion/>\" |");
my @data = <NUMFILES>;
foreach my $stuff(@data) {
if ($stuff =~ m/^<Endpoint
ep='([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/i) {
$main::dog = $1;
#print $main::dogshit;
}
## capturing the soapversion ###
if ($stuff =~
m/^<SoapVersion>([0-9]+)/i) {
my $cat = $1;
print "$main::dog -> $cat\n";
}
else
{
print "$host_ip$x -> Not accepting
connections, please try again later.\n";
}