Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

remote execute keyboard keys after connecting through telnet

by anandk_vec (Initiate)
on Oct 26, 2012 at 15:15 UTC ( [id://1001110]=perlquestion: print w/replies, xml ) Need Help??

anandk_vec has asked for the wisdom of the Perl Monks concerning the following question:

Im still not able to figure out how execute these keyboard keys on a remote telnet session. I checked EXPECT and PUT but dont know how to program it. The keyboard keys which i mentioned have to be entered from a remote telnet session which i establish using Net::Telnet to a network device.
  • Comment on remote execute keyboard keys after connecting through telnet

Replies are listed 'Best First'.
Re: remote execute keyboard keys after connecting through telnet
by Anonymous Monk on Oct 26, 2012 at 16:36 UTC
    It sounded like you didn't have CB60 open and weren't catching all the responses, so here's a transcript:
    • Tanktalus 2012-10-26 15:55:09 UTC anandk_vec: I would start by trying to send the characters across the telnet session directly: chr(25) . 'm'
    • anandk_vec 2012-10-26 16:00:34 UTC how? i cant get you
    • Tanktalus 2012-10-26 16:04:47 UTC Are you using Net::Telnet? How do you send text with that?
    • Tanktalus 2012-10-26 16:07:19 UTC Looks like Net::Telnet has a put method: $obj->put(String => chr(25) . 'm')
    • anandk_vec 2012-10-26 16:11:43 UTC i use ->cmd();
    • anandk_vec 2012-10-26 16:12:48 UTC $obj->cmd()
    • anandk_vec 2012-10-26 16:10:14 UTC voronich..you there
    • Tanktalus 2012-10-26 16:13:45 UTC Yes, but cmd will also send the \n character, whereas put doesn't. So you still use cmd for the command you're running, but use put for this.
Re: remote execute keyboard keys after connecting through telnet
by Old_Gray_Bear (Bishop) on Oct 26, 2012 at 16:31 UTC
    Yes, look at the Expect module

    ----
    I Go Back to Sleep, Now.

    OGB

Re: remote execute keyboard keys after connecting through telnet
by zentara (Archbishop) on Oct 26, 2012 at 18:22 UTC
    I see the problem coming from the delay between the keys release and the M and the Enter. I bet the timing gets thrown off after going thru the network connection.

    How about using SendKeys in a script on the server? Then just telnet in and execute the SendKeys script.


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1001110]
Approved by herveus
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-19 14:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found