Exit Telnet session

  • Thread starter chandrasekhar.karanam
  • Start date

C

chandrasekhar.karanam

Hi,

I wrote a perl file to telnet to Windows host using Net::Telnet.
Once I telnet to remote host I execute a perl script.
I am facing the problem with timeout, If I give default time out the
script fails to execute within the time, if I give more time out then
perl script executes but still it will not close the telnet session
until the time out reaches.

Below is the script
my $tel_obj = new Net::Telnet (errmode => 'return', Binmode =>0);
$tel_obj->buffer_empty;
$tel_obj->input_log($LOG_FILE);
if(!($tel_obj->open($ARGV[1]))) {
print "Unable to telnet...\n";
return 0;
}
$tel_obj->login(Name => $ARGV[2],
Password => $ARGV[3]);
$tel_obj->cmd(String => "cd $SOURCE_PATH");
my $sec = $tel_obj->timeout(99);
print $sec;
my $cmd_str = "perl $ARGV[4]";
$tel_obj->buffer_empty;
$tel_obj->cmd($cmd_str);
$tel_obj->close;

Please help me in solving this issue.
 
Ad

Advertisements


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

Top