ftp报文格式是怎样的啊???还有SMTP,POP3呢??

解决方案 »

  1.   

    FTP分控制和数据两种连接其中控制连接就是以文本流的方式传输的,你可以用telnet直接连接FTP的21端口,使用USER和PASS命令来登录
    FTP的命令还是比较多的,可以查查FTP的标准文档当你需要传输文件的时候,才临时使用PASV/PORT等命令建立数据连接
      

  2.   

    RFC 959                                                     October 1985
    File Transfer Protocol
             Block Header            +----------------+----------------+----------------+
                | Descriptor     |    Byte Count                   |
                |         8 bits |                      16 bits    |
                +----------------+----------------+----------------+
                         The descriptor codes are indicated by bit flags in the
             descriptor byte.  Four codes have been assigned, where each
             code number is the decimal value of the corresponding bit in
             the byte.            Code     Meaning
                
                 128     End of data block is EOR
                  64     End of data block is EOF
                  32     Suspected errors in data block
                  16     Data block is a restart er         With this encoding, more than one descriptor coded condition
             may exist for a particular block.  As many bits as necessary
             may be flagged.         The restart er is embedded in the data stream as an
             integral number of 8-bit bytes representing printable
             characters in the language being used over the control
             connection (e.g., default--NVT-ASCII).  <SP> (Space, in the
             appropriate language) must not be used WITHIN a restart er.         For example, to transmit a six-character er, the following
             would be sent:            +--------+--------+--------+
                |Descrptr|  Byte count     |
                |code= 16|             = 6 |
                +--------+--------+--------+            +--------+--------+--------+
                | Marker | Marker | Marker |
                | 8 bits | 8 bits | 8 bits |
                +--------+--------+--------+            +--------+--------+--------+
                | Marker | Marker | Marker |
                | 8 bits | 8 bits | 8 bits |
                +--------+--------+--------+
    Postel & Reynolds                                              [Page 22]
                                                                            
    RFC 959                                                     October 1985
    File Transfer Protocol
          3.4.3.  COMPRESSED MODE         There are three kinds of information to be sent:  regular data,
             sent in a byte string; compressed data, consisting of
             replications or filler; and control information, sent in a
             two-byte escape sequence.  If n>0 bytes (up to 127) of regular
             data are sent, these n bytes are preceded by a byte with the
             left-most bit set to 0 and the right-most 7 bits containing the
             number n.         Byte string:             1       7                8                     8
                +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+     +-+-+-+-+-+-+-+-+
                |0|       n     | |    d(1)       | ... |      d(n)     |
                +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+     +-+-+-+-+-+-+-+-+
                                              ^             ^
                                              |---n bytes---|
                                                  of data            String of n data bytes d(1),..., d(n)
                Count n must be positive.         To compress a string of n replications of the data byte d, the
             following 2 bytes are sent:         Replicated Byte:              2       6               8
                +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
                |1 0|     n     | |       d       |
                +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+         A string of n filler bytes can be compressed into a single
             byte, where the filler byte varies with the representation
             type.  If the type is ASCII or EBCDIC the filler byte is <SP>
             (Space, ASCII code 32, EBCDIC code 64).  If the type is Image
             or Local byte the filler is a zero byte.         Filler String:              2       6
                +-+-+-+-+-+-+-+-+
                |1 1|     n     |
                +-+-+-+-+-+-+-+-+         The escape sequence is a double byte, the first of which is the
    Postel & Reynolds