Net::Telnet connection status

J

juky

Hi all,

I'm using a Net::Telnet to send some commands to a router.
What I need to check now is my connection status after I sent any
commands. In some cases when I upload the router with particular
command it resets the connection and I must login again.
How can I do it?

Here my code:

.....
....
my $session = Net::Telnet->new(Host => $rt,
Timeout => 30);

{login part}

while ...... {

$session->print($command);
($output,$a)=$session->waitfor(Match => '/#/');
}


Thanks.

Juky
 
M

Mike Ferrari

I had the same issue, i was sending commands to a router and one of them
was a reload command. It would sever the connection. I didnt really care
about the status of the connection.
I just close the telnet session drop into a "wait" of 30 seconds or so
(however long it takes for the router to reload) and opened a telnet
conection to that device again.

I say this assuming you are not going through a terminal server to
connect to the console of the router.

Mike
 

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

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,162
Latest member
GertrudeMa
Top