Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^2: Managing TERM TYPE Option Requests with Net::Telnet

by initself (Monk)
on Aug 16, 2006 at 02:31 UTC ( [id://567581]=note: print w/replies, xml ) Need Help??


in reply to Re: Managing TERM TYPE Option Requests with Net::Telnet
in thread Managing TERM TYPE Option Requests with Net::Telnet

Excellent! Given your advice, I was able to see how use my telnet object $t as a socket.

First I set the TERM TYPE Option in the $nto object:

my %options = (TTYPE => { 'DO' => sub {} },); my $nto = Net::Telnet::Options->new(%options);

Then I set my telnetmode to 0:

$t->telnetmode(0);

After opening my host, I received three sets of data from the application server. Since the first request contained the TERM TYPE request, I sent the reply that I was an 'xterm' with the sendOpt function:

$t->open($host); recv($t, $data, 1024, 0); $nto->answerTelnetOpts($t, $data); $nto->sendOpt($t, 'SB', 24, 'IS', 'xterm'); recv($t, $data, 1024, 0); $nto->answerTelnetOpts($t, $data); recv($t, $data, 1024, 0); $nto->answerTelnetOpts($t, $data);

And then I went about my business as usual with Net::Telnet:

$t->telnetmode(1); ($prematch, $match) = $t->waitfor('/login:/');

Replies are listed 'Best First'.
Re^3: Managing TERM TYPE Option Requests with Net::Telnet
by castaway (Parson) on Aug 16, 2006 at 08:19 UTC
    Woo, I'm impressed. I would have thought that you could use the sub callback as you had before, with this method, and just get NTO to send the "xterm" reply for you.. But yours apparently works too. Since it doesnt really care in which order it gets which options replied to, and if you get a host that doesnt send the TTERM option, itll just ignore your reply.

    Would you mind trying with callback as well? Then I'll add this to the NTO docs, thanks!

    C.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2024-03-28 12:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found