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

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

Replies are listed 'Best First'.
Re^4: Net::Telnet issue
by dimishome (Beadle) on Feb 24, 2011 at 22:19 UTC
    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.