Reputation: 61
I'm getting command timeout sometimes but sometimes the same command runs. Why is this happening?
$port = new Net::Telnet(
Timeout => 180,
Errmode => 'die',
Dump_Log => "board_dumplog.log",
output_log => "outputlog.log",
input_log => "inputlog.log",
);
$port->open("xx.xxx.xx.x") or die "Cannot open telnet:$!";
$port->print("\n");
$port->waitfor('/login:/');
$port->print("root \n");
$port->cmd("./ne unittest");
Upvotes: 0
Views: 268
Reputation: 123330
It's probably timing out because the peer does not send what you expected it to send. To debug this kind of problems use input_log or dump_log like documented. From the documentation of waitfor:
Use dump_log() to debug when this method keeps timing-out and you don't think it should.
Upvotes: 3