$ telnet localhost 4000 Trying ::1... telnet: connect to address ::1: Connection refused Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection refused telnet: Unable to connect to remote host
当端口打开后,返回:
1 2 3 4
$ telnet localhost 4000 Trying ::1... Connected to localhost. Escape character is '^]'.
此时命令未退出!
根据提示 Escape character is '^]'.,可知:退出字符为 '^]'(CTRL+]);
此时输入其它字符不能使其退出,CTRL+C 都不行!
输入 CTRL+] 后会进入命令模式:
1 2
^] telnet>
此时再执行 quit 才会真正退出:
1 2
telnet> quit Connection closed.
其中,Escape character 可以自定义,使用参数-e:
1 2 3 4 5 6 7 8 9
# 使用p字符 $ telnet -e p localhost 4000 Telnet escape character is 'p'. Trying ::1... Connected to localhost. Escape character is 'p'. p telnet> quit Connection closed.