zoukankan      html  css  js  c++  java
  • DICT协议浅解

    最近偶然发现了这个好东东,DICT协议,一个字典服务器协议,A Dictionary Server Protocol

    协议全文在这里http://www.dict.org/rfc2229.txt,

    仔细看了下,也瞒简单的,如同FTP等高级协议一样,发送,响应

    来点具体滴,该协议约定服务器端侦听端口号:2628,咱先telnet连接到dict.org,做个快速测试

    先来个最快速的命令:HELP

    结果如图所示:

    image

    再来认识一个命令:DEFINE,接收参数包括数据名称,单词,以空白字符结束,必须的,否则会提示语法错误或参数错误,

    命令与参数这间,多个参数之间都需要用空白字符分隔

    如:DEFINE * hello 注意hello后边一定要跟一个空白字符如空格或TAB

    服务器响应如下图

    image

    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

    结果如图所示

    image

    再来认识一个命令,SHOW DB

    全称为 SHOW DATABASES,此命令将输出所有可用的数据库列表,如图

    image

    SHOW STRAT命令打印目前支付的策略,策略也是个好东西,回头单说

    image

    QUIT命令,功能退出,无参数,都是些简单的命令,先这么着,回头研究研究再写下篇

    更多信息请到官网http://www.dict.org/查询



    ------------------------------------------
    除非特别声明,文章均为原创,版权与博客园共有,转载请保留出处
    BUY ME COFFEE
  • 相关阅读:
    第34天-文件_system (2013.09.04)
    第33天-文件I/O _2(2013.09.03)
    小项目 : 计算库函数中单词的个数第30天
    第32天-文件I/O _1(2013.09.02)
    嵌入式培训学习历程第二十九天
    大作业 :学生信息管理系统。。。
    嵌入式培训学习历程第二十六天
    读取一个文件中哪一行 的一个参数
    LINUX C 语言 快速获取调用SHELL命令后的结果
    C语言制造一个随机数
  • 原文地址:https://www.cnblogs.com/kkun/p/1424052.html
Copyright © 2011-2022 走看看