Mud::Net::Telnet
A Telnet protocol manager (RFC 854).
The game implementation assumes a few things about a client connection:
- UTF-8 encoding of text in both directions,
- terminal emulation on the client side that supports ANSI control codes to modify the presentation of text.
In order to guarantee these assumptions hold, when we open a new Telnet connection we negotiate the following options:
- Binary Transmission (RFC 856), to ensure 8-bit clean data transfer,
- Terminal Type (RFC 1091), to query the client's terminal capabilites,
Additionally the interface is intended to be used with Line-editing on the client side such that the server receives content a line at a time. To guarantee this we try to negotiate (but don't require):
- Linemode (RFC 1184), to set the required line-editing configuration.
If during initial negotiations any of these options are rejected, then the client is informed of the incompability and the connection is closed. Otherwise we begin sub-negotiations to check for the right terminal type and line-editing configuration.
Once all the configuration is complete the game can start to talk to the client, safe in the above assumptions.
The implementation below has been tested against the following Telnet client programs:
- Inetutils telnet on xterm
- OpenBSD telnet on xterm
- Windows 10 telnet on CMD
- PuTTY telnet
Constants
Accepted terminal types