Skip to content

Commit 91c5003

Browse files
committed
Add a comment explaining terminal type negociation in telnet
1 parent 6657975 commit 91c5003

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

prompt_toolkit/contrib/telnet/server.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,12 @@ def _initialize_telnet(connection: socket.socket) -> None:
6262
connection.send(IAC + DO + NAWS)
6363

6464
# Negotiate terminal type
65+
# Assume the client will accept the negociation with `IAC + WILL + TTYPE`
6566
connection.send(IAC + DO + TTYPE)
6667

67-
# Negotiate terminal type
68+
# We can then select the first terminal type supported by the client,
69+
# which is generally the best type the client supports
70+
# The client should reply with a `IAC + SB + TTYPE + IS + ttype + IAC + SE`
6871
connection.send(IAC + SB + TTYPE + SEND + IAC + SE)
6972

7073

0 commit comments

Comments
 (0)