最近偶然发现了这个好东东,DICT协议,一个字典服务器协议,A Dictionary Server Protocol
协议全文在这里http://www.dict.org/rfc2229.txt,
仔细看了下,也瞒简单的,如同FTP等高级协议一样,发送,响应
来点具体滴,该协议约定服务器端侦听端口号:2628,咱先telnet连接到dict.org,做个快速测试
先来个最快速的命令:HELP
结果如图所示:
再来认识一个命令:DEFINE,接收参数包括数据名称,单词,以空白字符结束,必须的,否则会提示语法错误或参数错误,
命令与参数这间,多个参数之间都需要用空白字符分隔
如:DEFINE * hello 注意hello后边一定要跟一个空白字符如空格或TAB
服务器响应如下图
150为服务器响应码,一般以1打头的基本都是正确的响应,比较详细列表如下      * 110 n databases present - text follows
      * 111 n strategies available - text follows
        112 database information follows
        113 help text follows
        114 server information follows
        130 challenge follows
      * 150 n definitions retrieved - definitions follow
      * 151 word database name - text follows
      * 152 n matches found - text follows
        210 (optional timing and statistical information here)
      * 220 text msg-id
        221 Closing Connection
        230 Authentication successful
        250 ok (optional timing information here)
        330 send response
        420 Server temporarily unavailable
        421 Server shutting down at operator request
        500 Syntax error, command not recognized
        501 Syntax error, illegal parameters
        502 Command not implemented
        503 Command parameter not implemented
        530 Access denied
        531 Access denied, use "SHOW INFO" for server information
        532 Access denied, unknown mechanism
        550 Invalid database, use "SHOW DB" for list of databases
        551 Invalid strategy, use "SHOW STRAT" for a list of strategies
        552 No match
        554 No databases present
        555 No strategies available
   500 Syntax error, command not recognized
   501 Syntax error, illegal parameters
   502 Command not implemented
   503 Command parameter not implemented
   420 Server temporarily unavailable
   421 Server shutting down at operator request
151 "hello" gcide “The Collaborative International Dictionary of English v.0.48”hello 为我们输入,gcide为数据库缩写,后边引号引起来的即为它的全称,DEFINE后边的*号表示,查询所有可用数据库,再往后的就是要查询的单词喽,还可以使用!号代替*号,或者使用具体的数据库来代替如输入:DEFINE wn hello结果如图所示
再来认识一个命令,SHOW DB全称为 SHOW DATABASES,此命令将输出所有可用的数据库列表,如图
SHOW STRAT命令打印目前支付的策略,策略也是个好东西,回头单说QUIT命令,功能退出,无参数,都是些简单的命令,先这么着,愚人节快乐
更多信息请到官网http://www.dict.org/查询