ike_ipsec_dude has asked for the wisdom of the Perl Monks concerning the following question:
My thought was "see example below" was to take the var $t =Net:: etc Was on the next iteration change $t to $t2 then $t3 etc hence making many open telnet connections with data streaming back to them. I am having major brain farts here. Maybe there is a better way?
and how to increment a var before it gets assigned by...
so that on the next iteration we get....$t = Net::Telnet->new(Timeout => 10, Port => 23,Prompt => '/.*\>/');
Example code:$t2 = Net::Telnet->new(Timeout => 10, Port => 23,Prompt => '/.*\>/');
use Net::Telnet; use Getopt::Long; getOpts (); create_streams (); if (defined($duration)) {sleep $duration;} if (!defined($duration)) {sleep 3600;}# default to an hours run time ############################################################ # A simple routine to connect to a telnet Virtual IP ,port 23 # ############################################################ sub create_streams { $ip1 = 192.168; $ip3 = 1; $ip4 = 1; LOOP: if ($ip4 == 254) { $ip3++; $ip4 = 1; } $t = Net::Telnet->new(Timeout => 10, Port => 23,Prompt => +'/.*\>/'); $t->timeout; $t->open(Host => "$ip.$ip3.$ip4", Errmode => "return", Tim +eout => 1); if ($ip3 == 254) {goto NEXT;} $ip4++; goto LOOP; NEXT: }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to fork/spawn 64k telnet connections and keep them all open
by DrHyde (Prior) on Oct 02, 2003 at 08:19 UTC | |
by ike_ipsec_dude (Initiate) on Oct 02, 2003 at 13:07 UTC | |
|
Re: how to fork/spawn 64k telnet connections and keep them all open
by BrowserUk (Patriarch) on Oct 02, 2003 at 09:59 UTC | |
by zengargoyle (Deacon) on Oct 02, 2003 at 10:32 UTC | |
by BrowserUk (Patriarch) on Oct 02, 2003 at 10:41 UTC |