Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
or#!/usr/bin/perl -w use Net::Telnet; use constant HOST=>'192.168.10.150'; use constant USER=> 'patil'; use constant PASS=>'patil'; my $telnet=Net::Telnet->new(HOST); $telnet->login(USER,PASS); my @lines=$telnet->cmd('ps -ef'); print @lines; ~
By using above two methods i am trying to connect to remote server, it woking fine,but after running this script,i unable to connect to remote server,after timeout period its diplaying a massage as"timed-out waiting for command prompt at 354.pl line 7".so what could be the reason for this,pls suggest me so, that i can further proceed in my work. waiting for suggetion. ~ ~ ~ ~ ~ ~~#!/usr/bin/perl -w use Net::Telnet; $telnet = new Net::Telnet ( Timeout=>10, Errmode=>'die'); $telnet->open('192.168.10.220'); $telnet->waitfor('/login: $/i'); $telnet->print('patil'); $telnet->waitfor('/password: $/i'); $telnet->print('patil'); $telnet->waitfor('/\$ $/i'); $telnet->print('who'); $output = $telnet->waitfor('/\$ $/i'); print $output;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem to connect remote server by using telnet module
by shmem (Chancellor) on Jun 26, 2006 at 09:57 UTC | |
|
Re: Problem to connect remote server by using telnet module
by marto (Cardinal) on Jun 26, 2006 at 10:00 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |