468,242 Members | 1,587 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,242 developers. It's quick & easy.

net::telnet Prompt and timeout issue

Any pointers on this truly appreciated.

I am using net::telnet to connect to a modem pool and then connect with a remote piece of kit. Everything works fine normally, however on occassions the remote piece of kit may be busy and will not talk to me, leaving me to logoff cleanly and try again later.

Using net::telnet and the following code I am trying to wait for the prompt of ? to be returned if it is not returned after 60 seconds I wisk to run a sub that will basically log me off the device cleanly (failure to do so can leave the device port hung stopping further access until reset).

Expand|Select|Wrap|Line Numbers
  1.                 $telnet->cmd(String => "$level",
  2.                         Prompt =>'/USER:$/');
  3.                 $telnet->cmd(String => "$user",
  4.                         Prompt => '/KEY:$/');
  5.                 $connected = $telnet->cmd(String => "$pass",
  6.                         Prompt => '/\?/',
  7.                         Timeout => 60,
  8.                         Errmode => sub{&prompterr($params)} );
The issue is that the code jumps straight to the errmode rather than waiting for the prompt or the timeout!!!

Can anyone point me in the direction as to where I have gone wrong? Have I completely misunderstood how to use this?!?!

Best regards

Jul 18 '08 #1
0 3249

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Pete Johansen | last post: by
1 post views Thread by kriz4321 | last post: by
1 post views Thread by jyohere | last post: by
2 posts views Thread by kriz4321 | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.