Look at the Telnet RFCs listed on Google
, especially RFC 857
. If you're really interested in TCP/IP-related things, check out TCP/IP Illustrated, Volume 1
(where I easily looked up how to make the aliases below) and later volumes.
; Send IAC DO ECHO (255 253 1) to have the client echo keypresses to the user
alias startecho sockwrite $1 $+($chr(255), $chr(253), $chr(1))
; Send IAC DONT ECHO (255 254 1) to have the client hide keypresses
alias stopecho sockwrite $1 $+($chr(255), $chr(254), $chr(1))
When using these, a Telnet client will generally respond with IAC WILL ECHO (255 251 1) or IAC WONT ECHO (255 252 1), so you'll need to handle or ignore these sequences in your sockread event.