MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Re: Telnet codes...




On Sat, 13 Jan 1996, Ahn Jin-su wrote:

> > > Again, I want to know if anyone knows the telnet codes for line-at-a-time 
> > > and character-at-a-time codes...
> > 
> > There aren't any such codes; the telnet protocol does not have a way for one
> > end to change the `at-a-time' mode of the other end.
> 
> RFC 1184 describes the linemode feature.

I don't think that was what they were asking for though. That seems to 
describe a way to have line editing take place solely on the client end of 
the connection. That might be a better way to go, but I think they were 
asking how to tell the telnet client wether to send each character as it 
is typed or wait until an entire line of input was entered...

RFC 857, Telnet Echo Option says:

>   The echoing option alone will normally not be sufficient to effect
>   what is commonly understood to be remote computer echoing of
>   characters typed on a terminal keyboard--the SUPPRESS-GO AHEAD option
>   will normally have to be invoked in conjunction with the ECHO option
>   to effect character-at-a-time remote echoing.

RFC 858, Telnet Suppress Go Ahead Option says:

>   In many TELNET implementations it will be desirable to couple the
>   SUPPRESS-GO-AHEAD option to the echo option so that when the echo
>   option is in effect, the SUPPRESS-GO-AHEAD option is in effect
>   simultaneously:  both of these options will normally have to be in
>   effect simultaneously to effect what is commonly understood to be
>   character at a time echoing by the remote computer.

You need to tell the client that you are turning these options on or off.

To tell the other side you'll start both options, you send IAC WILL ECHO
and IAC WILL SUPPRESS-GO-AHEAD. To turn them off you use WON'T in place
of WILL.

>From RFC 854, Telnet Protocol Spec:
>       WILL (option code)  251    Indicates the desire to begin
>                                  performing, or confirmation that
>                                  you are now performing, the
>                                  indicated option.
>       WON'T (option code) 252    Indicates the refusal to perform,
>                                  or continue performing, the
>                                  indicated option.
[...]
>       IAC                 255    Data Byte 255.

ECHO is assigned code 1 and SUPPRESS-GO-AHEAD has code 3...

So to turn on char-at-a-time mode:
;;player:tell(chr(255),chr(251),chr(1),chr(255),chr(251),chr(3))
And go back to line-at-a-time mode:
;;player:tell(chr(255),chr(252),chr(1),chr(255),chr(252),chr(3))

This seems to work fine for me. =8-)

You will have to handle editing chars like backspaces yourself in
char-at-a-time mode, plus the end of line is probably different. If you
are just gonna be echoing every character back to the client unaltered
you can probably just leave ECHO enabled.

TTFN
Andy



References:

Home | Subject Index | Thread Index