#1
|
|||
|
|||
TELNET Time-out too long
Hello,
I am using SecureCRT6.2.2 with Active Perl scripting. I am creating a script that connects to remote routers and grabs information from them. Some of these routers are down at the time when I run the script and the script waits about 30-60 seconds before declaring the TELNET session down and moves on to the next site. If I need to check 100 routers and I wait for 30-60 per site that's down I could be running the script for 20+ minutes. Is there a way to put a limit of 10 or 5 seconds on the TELNET? For example, If I don't get a prompt in 5 seconds then skip this connection and move to the next one. I tried something like this but it doesn't work: +++++++++++++++++++++++++++++++++++++++++ sub CheckCon { $crt->session->Connect("/TELNET $wanip"); if ($crt->session->Connected()) { $connectiondown = "No"; } else { $connectiondown = "Yes"; } } sub LogintoDevice { $rescheck = $crt->Screen->WaitForStrings ("Login:", 10); if ($rescheck == 0) { print FAILLOGIN "Telnet_timeout\n"; $crt->Session->Disconnect(); } elsif ($rescheck == 1) { $crt->Screen->Send ("$AdminUser\n"); $crt->Sleep("100"); $crt->Screen->WaitForString ("assword:"); $crt->Screen->Send ("$AdminPasswd\n"); $crt->Sleep("100"); } } +++++++++++++++++++++++++++++++++++++++++ Thank you for your time Adrian |
#2
|
|||
|
|||
Hi Adrian,
You could handle authentication in the terminal window to avoid this issue. We have an example in VBScript that illustrates how to accomplish this: http://forums.vandyke.com/showthread...7087#post37087Does this help you accomplish your goal? |
![]() |
Tags |
telnet , timeout , waitforstring |
Thread Tools | |
Display Modes | Rate This Thread |
|
|