iug has asked for the wisdom of the Perl Monks concerning the following question:
Hello, I'm newbie to Perl. I'm trying to connect to a device throw telnet. It looks like the connection is done. But I'm unable to get info from it.
It's supposed to be quite fordwarding but no way. I post some kind of code that looks like mi own code.
No login required! I don't know if could be something related to genociation. Also tried with no luck
#!/usr/bin/perl use strict; use warnings; use Net::Telnet(); my $host='xxx.xxx.xxx.xxx'; $t = new Net::Telnet (Timeout => 10, "Prompt" => '/[$%#>] \z/n'); $t->open($host); $t->cmd("command"); while (my $t = $t->getline()) { print "$line" } $t->close(); exit 1;
It gets stack in the "cmd" line. And it returns time-out error Any idea? Thanks a lot
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Unable to get infor from telnet conection
by roboticus (Chancellor) on Nov 28, 2019 at 16:35 UTC | |
by iug (Initiate) on Nov 29, 2019 at 07:30 UTC |