我寫的小代碼使用Perl,但觀察的錯誤消息爲什麼我的Net :: Telnet程序超時?
#!/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;
連接到遠程服務器,但在運行時我得到以下錯誤
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:\>
幫我在這方面。我是Perl的新手。