Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Telnet server that read a single character

by sflitman (Hermit)
on Apr 08, 2010 at 05:41 UTC ( #833442=note: print w/replies, xml ) Need Help??

in reply to Telnet server that read a single character

NetServer::Generic hasn't been updated in 10 years, its author quit programming and became a famous science fiction writer.

I would suggest using a more maintained and mature module like IO::Socket::Telnet::HalfDuplex.

For your error, the problem is that you're probably not connecting to a real terminal, I'm guessing you want the telnet running on localhost.

Also, please tell us what you're trying to accomplish with single character read. It's not really what telnet is about, and perhaps you don't really want telnet either since it isn't at all secure.


  • Comment on Re: Telnet server that read a single character

Replies are listed 'Best First'.
Re^2: Telnet server that read a single character
by Anonymous Monk on Apr 08, 2010 at 08:48 UTC
    I tried to use HalfDuplex module, but I have the same problem.
    sub Terminal { my ($server, $client) = @_; my $input; my $key; while (1) { #ReadMode(4, $client); while (not defined ($key = ReadKey(0, $client))) {}; #ReadMode(0, $client); if ($key eq "q") { return 1; } else { print "Got character '" . ord($key) . "'\r\n"; } }; return 0; } my $server = IO::Socket::Telnet::HalfDuplex->new ( Proto => 'tcp', LocalPort => 23, Listen => SOMAXCONN, Reuse => 1 ); print "Starting server\n"; while (my $client = $server->accept()) { Terminal($server, $client); close $client; }
    The same problem occur when I don't use localhost. What I'm tring to accomplish is a terminal that will be somewhat like cisco terminal, meaning it will auto complete options when I press <tab> or <?> Thanks, Dayan Shay
      Someone? I simply want a tcp server that read a single character from the client. I don't care how.
        Maybe it is already solved... but seems to be useful to someone else. Don't use Term::ReadKey. You should negotiate remote telnet client from server side during session. Read this:

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://833442]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2018-04-19 23:28 GMT
Find Nodes?
    Voting Booth?