CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
net::telnet - timed-out waiting for login prompt

 



sumant
Novice

Oct 8, 2007, 11:09 PM

Post #1 of 7 (847 views)
net::telnet - timed-out waiting for login prompt Can't Post

Hi,
I am trying to connect an application on port 2101.
when I do > telnet ps4131 2101 from dos prompt it shows me a blank screen without any prompt.
Through perl code written below I am getting error message : timed -out waiting for login prompt...

Code
$telnet = new Net::Telnet ( Port=> 7101 , Timeout=>10, Errmode=>'die'); # default matched with Prompt=>'/[$%#>] \z/n' 
$telnet->open('ps4131');
$telnet->login('administrator', 'password');
print $telnet;



How to avoid checking of prompt or what need to be matched for nothing for prompt.

thanks
sumant


winfinit
User

Oct 31, 2007, 3:56 AM

Post #2 of 7 (829 views)
Re: [sumant] net::telnet - timed-out waiting for login prompt [In reply to] Can't Post

well, if you are not getting login prompt via command prompt, net::telnet module is not going to help you, because it will wait for that prompt, and if your application is not giving it, then net::telnet will timeout on you.



what are you trying to script exactly, if you could, please post your full succesful telnet session (done via command prompt or shell)


sumant
Novice

Oct 31, 2007, 4:10 AM

Post #3 of 7 (828 views)
Re: [winfinit] net::telnet - timed-out waiting for login prompt [In reply to] Can't Post

hmmm.
I got this by reading some more info on net.
SO I decided to have a socket connection.
and the script is working fine at customer end.

thanks for your help.


winfinit
User

Oct 31, 2007, 4:23 AM

Post #4 of 7 (824 views)
Re: [sumant] net::telnet - timed-out waiting for login prompt [In reply to] Can't Post

does your application requires login or it doesnt? if it does then it should prompt you for one, if it doesnt, then you dont need to use $telnet->login('administrator', 'password');
because thats where your timeout will accur, it will wait for something that app not prompting for.


sumant
Novice

Oct 31, 2007, 4:29 AM

Post #5 of 7 (822 views)
Re: [winfinit] net::telnet - timed-out waiting for login prompt [In reply to] Can't Post

I send several commands to that application.
First I need to login then only it will accept my commands.
So the script was waiting for login prompt and it was not going ahead.
So the login is also the command for the application.
Is it possible that script do not wait for any prompt and I can send the command directly?


winfinit
User

Oct 31, 2007, 4:44 AM

Post #6 of 7 (821 views)
Re: [sumant] net::telnet - timed-out waiting for login prompt [In reply to] Can't Post

sure you can, for example when you telnet on port 110, nothing will ask you for user name and password, so you can start printing your commands

$pop = new Net::Telnet (Telnetmode =>0);
$pop->open(Host => 'localhost',
Port => 110);

$line = $pop->getline;
print "$line<br>";

$pop->print("user username"); #note that i am not waiting for login prompt, i am already connected at this step and i am just sending command to telnet "user usernamehere"
$line = $pop->getline; #this will just tell me what happened with previous command etc... (not necessary to use this line
print "$line<br>";
$pop->print("pass password");


$line = $pop->getline;
print "$line<br>";
$pop->print("quit");
$line = $pop->getline;
print "$line<br>";


sumant
Novice

Oct 31, 2007, 4:51 AM

Post #7 of 7 (819 views)
Re: [winfinit] net::telnet - timed-out waiting for login prompt [In reply to] Can't Post

ok..
I will try this one also...might help in future.
thanks a lot.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives