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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.