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
In reply to Re^3: Net::Telnet issue
by Eliya
in thread Net::Telnet issue
by dimishome
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |