(Along with the utility of force-closing connections, this is also why it can be surprisingly difficult to use SSH in situations where you want a low-privilege user to be able to access the shell of a remote system, but not immediately get up to crazy network shenanigans. SSH is actually too feature-rich for that use case, and this escape-character menu is an example of why; even if you somehow take control of the command line entirely, they can still start opening reverse forwards and doing a variety of other things. Very useful for reasonably privileged users, though.)
https://github.com/dspinellis/unix-history-repo/blob/usr/src...
https://en.wikipedia.org/wiki/End-of-Transmission_character#...
\n~. is for gracefully exiting a stuck/hung SSH session (e.g. one where the remote isn't responding to input) without force-killing the SSH client itself (which might do bad things to the process group it lives in.)
Being the least interesting programmer on Hacker News, I don't always write code to handle Telnet-compatible ASCII input, but when I do, I always support ^D.