Telnet is a network protocol used on the Internet or local area networks to provide a bidirectional interactive text-oriented communications facility using a virtual terminal connection. All data octets except \377 are transmitted over the TCP transport as is. Therefore, a Telnet client application may also be used to establish an interactive raw TCP session, and it is commonly believed that such session which does not use the IAC (\377 character, or 255 in decimal) is functionally identical.

由于telnet在传输数据时会传输字符本身(除\377外),所以它可以用来建立一个交互的raw TCP session(当然telnet data跟 raw TCP data还是有很多区别的,详见【1】)。也就是说,只要你输入的命令符合某个应用层协议,那么你就可以用这些命令来模仿某个应用层协议与server对话,比如我们来模仿HTTP协议。以www.baidu.com为例子,运行telnet www.baidu.com 80,这时会出现一个黑框,等待我们输入HTTP的命令,输入以下命令GET / HTTP/1.1,然后telnet就会返回www.baidu.com 的主页内容了。对于其他的协议也是同样的道理,所以telnet就有个奇妙的用处,用来debug网络问题。比如你设置了某个网络的中间件,proxy或者其他的什么东西,但是你的应用,比如无法收取邮件或者无法登录邮件服务器,你就可以先用telnet尝试连接你邮件服务器打开的端口,如果能连接上,说明服务器端口是好的,就应该在应用层找原因;而如果无法链接该端口,说明TCP链接不通,确认端口确实打开了,或者确认防火墙或者网络设置导致链路不通。

下面我们看看telnet的应用吧。

BBS是指Bulletin Board System,即电子公告牌,可以用telnet(term软件)的方式浏览;论坛的英文是Forum,只能用web浏览器浏览(如IE、Firefox) ,所以可以这样理解,能telnet的才是BBS,否则都属于Forum
国内著名BBS:水木(清华)、两全其美(北大)、饮水思源(上交)、小百合(南大)

再看看telnet的弱点:

telnet的致命弱点就是安全性不足,详细的看:http://en.wikipedia.org/wiki/Telnet#Security。 因此大家就转向了更为安全的SSH了

 

1.  http://en.wikipedia.org/wiki/Telnet#Telnet_data

2.  telnet on Windows7: http://www.chinavalue.net/Story/82135.aspx