use the NETBIOS over IP port "137" or "138" or "139" and do just a simple
TCP three way handshake to find out is he remote site reachable. This is
possible by using Net::Ping  Regarding working in parallel with multiple
hosts I do it like this (please take care to work with a appropriable amount
of host in the same time)(I'm using not more then 300 per time)

use Net::Ping;
use threads;
my @HOST = ("1.2.3.4", "2.3.4.5", "3.4.5.6");

# start
threads->new( \&touchHost, $_) foreach (@HOSTS);

# wait for ending
$_->join() foreach $_ (threads->list());

#########################
# 
sub touchHost{
        my $host = shift;
        my $tid = threads->self->tid();                 # get thread ID
        
        my $p = Net::Ping->new('tcp', 2);
        $p->hires();
        $p->{port_num} = '138';
        my ($ret, $duration, $host) = $p->ping($ip);
        $p->close();

        if($ret){
                $result = sprintf("%.3f", 1000 * $duration);
                print "[$tid]\t measured round trip delay is $result ms\n"
        }else{
                print "[$tid]\t host '$host' not reachable\n";
                return;
        }

        # do what ever you like to do.
}

Markus


-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Im Auftrag von
Ng, Bill
Gesendet: Freitag, 12. Mai 2006 17:27
An: perl-win32-users@listserv.ActiveState.com
Betreff: Network Timeouts

Dilemma,

        I have many scripts that have to hit every machine in my domain
.. about 2400.  I can't use Net::Ping to test the alive status of the
boxes because our internal DNS system is a real PITA to clean up and
using as-is will leave me with bad results.

        For now, I'm doing a write test:  if (open (WRITETEST,
">c:\write.test")) { &doSomething(); } ... but the timeout on such a
test, if the machine its trying to reach is not available, is just too
long.

        Anyone have a way of me testing the connectivity to a computer
on the network that allows me to either configure the timeout or has one
between 1 and 2 seconds?

Bill in Brooklyn

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to