在调试一个网络程序时遇到问题,服务启动了,客户端却连接不上;首先就想到了用telnet连接看看;
命令和Windows下一样,telnet IP 端口号
-
# telnet 192.168.0.107 1111
-
Trying 192.168.0.107...
-
telnet: connect to address 192.168.0.107: Connection timed out
连接超时了,估计是Windows防火墙的问题,我的服务是跑在Windows上的;
控制面板》系统安全》Windows防火墙》高级设置》新建入站规则;
再执行telnet命令看看,
-
Trying 192.168.1.107...
-
Connected to 192.168.1.107.
-
Escape character is '^]'.
连接成功,果然是防火墙的问题!
诶[éi],怎么回事! 退不出去了!Ctrl + c,Ctrl + z,ESC,q,quit,exit,都不行;
注意telnet连接成功后输出的信息:
-
Escape character is '^]'.
Ctrl + ]
姿势终于对了;
-
telnet> ?
-
Commands may be abbreviated. Commands are:
-
-
close close current connection
-
logout forcibly logout remote user and close the connection
-
display display operating parameters
-
mode try to enter line or character mode ('mode ?' for more)
-
open connect to a site
-
quit exit telnet
-
send transmit special characters ('send ?' for more)
-
set set operating parameters ('set ?' for more)
-
unset unset operating parameters ('unset ?' for more)
-
status print status information
-
toggle toggle operating parameters ('toggle ?' for more)
-
slc change state of special charaters ('slc ?' for more)
-
z suspend telnet
-
! invoke a subshell
-
environ change environment variables ('environ ?' for more)
-
? print help information
-
telnet> close
-
Connection closed.
输入问号然后回车,可以查看帮助;
输入close或quit然后回车,可以退出telnet;
(责任编辑:IT) |