What I am try to do is open a telnet connection to a telnet server. As soon as the client connects to the server I just send and endless loop banner back to the telnet client
to keep the connection open and active. Now I want to keep this connection open and iterate
thru the IP addresses of a classB net. ie;64k

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...

$t = Net::Telnet->new(Timeout => 10, Port => 23,Prompt => '/.*\>/');
so that on the next iteration we get....
$t2 = Net::Telnet->new(Timeout => 10, Port => 23,Prompt => '/.*\>/');
Example code:
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: }

In reply to how to fork/spawn 64k telnet connections and keep them all open by ike_ipsec_dude

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.