My loop doesn't work.

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";
}
 
B

Brian McCauley

usaims said:
I am writing a program that will check to see if a certain port, in a
sequence of seruvers, 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?

The code you posted appears to have been truncated.

Are you sure this isn't something as simple as server already having
the maximum number of queued connections already?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top