Commands and option negotiation
Echo and Suppress Go Ahead
Understand why Telnet negotiates who echoes typed characters and whether the old half-duplex Go Ahead signal is needed.
8 minute lesson
When you type a character into a terminal session, something has to display it. That job is called echo, and there are two ways to assign it.
With local echo, the client displays a character as you type it. With remote echo, the server sends the character back and the client displays the returned copy.
Telnet negotiates the ECHO option, defined in RFC 857 as option code 1, so both sides do not echo the same input. A typical remote-login server offers to do the echoing:
server: 255 251 1 IAC WILL ECHO (I will echo what you type)
client: 255 253 1 IAC DO ECHO (agreed, you echo)
After this exchange the client stops echoing locally and displays only what the server returns.
Get this wrong and you see it immediately. Two echoes duplicate characters, so typing ls shows llss. No echo makes typing appear invisible even though bytes may still be sent. Remote echo is also why old-school servers could hide your password: they agreed to echo, then chose not to echo those characters.
Suppress Go Ahead
The original NVT model assumed half-duplex terminals that could not send and receive at the same time. It included a Go Ahead signal, IAC GA, meaning “your turn to transmit”.
Modern connections are full duplex, so the signal is pure overhead. Sessions normally negotiate Suppress Go Ahead, or SGA, option code 3, in both directions:
server: 255 251 3 IAC WILL SGA
client: 255 253 3 IAC DO SGA
Both directions matter because, as you learned in the previous lesson, each direction is a separate agreement. ECHO and SGA together are what turn a Telnet session into the character-at-a-time mode most people expect.
Echo is not buffering
Echo behavior and line buffering are separate ideas. A client may show characters locally while waiting for Enter before sending a line, or it may send each character immediately. One question is who paints the character on screen. The other is when bytes leave the machine. Keep them apart when you debug a strange-feeling session.
Lesson completed