Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 07-12-2013, 06: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
  #2  
Old 07-15-2013, 07:36 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,305
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#post37087
Does this help you accomplish your goal?
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
Reply

Tags
telnet , timeout , waitforstring

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT -6. The time now is 03:24 AM.