Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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.

HTH,
SSF


Comment on Re: Telnet server that read a single character
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: http://stackoverflow.com/questions/273261/force-telnet-client-into-character-mode http://hints.jeb.be/protocols/telnet-network-virtual-terminal-nvt/ http://stackoverflow.com/questions/4532344/send-data-over-telnet-without-pressing-enter

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://833442]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2014-10-31 07:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (215 votes), past polls