in reply to Re: Net::Telnet issue
in thread Net::Telnet issue

I understand that, the issue is with the Rad RICi-T3 I am attempting to telnet into. Before you can even log into the device, you need to send a char because it loads a blank screen initially. I have attempted to use "", " ", "\033" all to no avail. Once the char is sent, then you get the username and password prompts. My issue is that with Net::Telnet, I am not able to send the char before attempting to authenticate through the device. Once you log into the device, the prompt is '>'. I have used the waitfor and print calls but to no avail.

Replies are listed 'Best First'.
Re^3: Net::Telnet issue
by Eliya (Vicar) on Feb 24, 2011 at 22:04 UTC

    Can you log in with a normal telnet client from the command line?  If so, what exactly do you have to type?

    Net::Telnet definitely does send \r\n when you say $t->print():

    Here's a simple "telnet server" that simply echoes back in hex what you send it

    #!/usr/bin/perl use IO::Socket; my $sock = IO::Socket::INET->new( LocalAddr => "localhost:9999", ReuseAddr => 1, Listen => SOMAXCONN, ) or die "couldn't create socket: $!\n"; while (1) { my $client = $sock->accept(); while (my $line = <$client>) { print $client join(" ",unpack("(H2)*", $line)), "\n"; } close $client; }

    When you connect to it with a standard telnet client, and press <Enter> once, you get

    $ telnet localhost 9999 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 0d 0a

    When you connect with the following Net::Telnet code

    #!/usr/bin/perl -w use strict; use Net::Telnet; my $t = Net::Telnet->new(Port => 9999); $t->open("localhost"); $t->print; my $r = $t->getline; print $r;

    you get exactly the same:

    $ ./890020_c.pl 0d 0a
      I log in through telnet as follows: telnet 192.168.3.35 <enter> <esc> USER NAME: <user><enter> PASSWORD: <pass><enter> The issue is the blank screen when it connects initially that is causing the issue. Once you hit any char, then the login page loads.