Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl telnet looping problem

Reply
Thread Tools

Perl telnet looping problem

 
 
CJ
Guest
Posts: n/a
 
      03-21-2005
Can someone look at the code below and tell me whats going on?

Here is the problem. I can successfully telnet one of our routers and
successfully put in a command in the while statement, but when the loop goes
around a second time, it gives me:
"pattern match timed-out at c:\filename.pl line 21"

It can't get past the waitfor statement for a prompt the 2nd go around in
the loop.

Ideas??

================================================== ====

use Net::Telnet;
use constant PASS=>'password';

$i=6300;
$telnet = new Net::Telnet (Timeout=>25);

$ip='<IP ADDRESS HERE>';

$telnet->open($ip);
$telnet->waitfor('/assword: /');
$telnet->print(PASS);

while ($i < 6400) {

print "LOOPED!!!\n"; 'for troubleshooting purposes
$prompt = $telnet->waitfor('/> /');
print "MADE IT PAST PROMPT\n"; 'for troubleshooting purposes

$statement=('<command goes here>');

$telnet->cmd($statement);
print "PORT FILTER ADDED\n"; 'for troubleshooting
$i++;

}


$telnet->close;


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
looping in array vs looping in a dic giuseppe.amatulli@gmail.com Python 5 09-20-2012 11:58 PM
Telnet - attempting to initiate a telnet session within an established telnet session Carcarius Ruby 0 12-06-2007 03:26 AM
Need to talk to a telnet server and send a telnet break Jim Isaacson C Programming 5 11-05-2004 09:17 PM
Enumerate question: Inner looping like in Perl Pekka Niiranen Python 5 10-31-2004 10:28 AM
How can I telnet when I dont have specific access to a telnet client Jack B. Pollack Computer Support 4 07-24-2003 08:58 PM



Advertisments