View Single Post
  #1  
Old 07-12-2013, 07:07 PM
thehawk thehawk is offline
Registered User
 
Join Date: Oct 2012
Posts: 7
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
Reply With Quote