Why does my Net::Telnet program timeout?
Posted
by user304852
on Stack Overflow
See other posts from Stack Overflow
or by user304852
Published on 2010-03-30T07:05:46Z
Indexed on
2010/03/30
17:23 UTC
Read the original article
Hit count: 643
perl
|perl-module
I'm written small code to connect to remote server using Perl but observing error messages
#!/usr/bin/perl -w
use Net::Telnet;
$telnet = new Net::Telnet ( Timeout=>60, Errmode=>'die');
$telnet->open('192.168.50.40');
$telnet->waitfor('/login:/');
$telnet->print('queen');
$telnet->waitfor('/password:/');
$telnet->print('kinG!');
$telnet->waitfor('/:/');
$telnet->print('vol >> C:\result.txt');
$telnet->waitfor('/:/');
$telnet->cmd("mkdir vol");
$telnet->print('mkdir vol234');
$telnet->cmd("mkdir vol1");
$telnet->waitfor('/\$ $/i');
$telnet->print('whoamI');
print $output;
But while running i'm getting following errors
C:\>perl -c E:\test\net.pl
E:\test\net.pl syntax OK
C:\>perl E:\test\net.pl
command timed-out at E:\test\net.pl line 13
C:\>
Help me in this regard.. i'm not much aware of perl
© Stack Overflow or respective owner