ftp报文格式是怎样的啊??

vital123 2008-05-07 02:06:57
ftp报文格式是怎样的啊???还有SMTP,POP3呢??
...全文
3112 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
11000000 2008-05-08
  • 打赏
  • 举报
回复
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 marker

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 marker 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 marker.

For example, to transmit a six-character marker, 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
vocanicy 2008-05-07
  • 打赏
  • 举报
回复
FTP分控制和数据两种连接

其中控制连接就是以文本流的方式传输的,你可以用telnet直接连接FTP的21端口,使用USER和PASS命令来登录
FTP的命令还是比较多的,可以查查FTP的标准文档

当你需要传输文件的时候,才临时使用PASV/PORT等命令建立数据连接
Roylue 2008-05-07
  • 打赏
  • 举报
回复
非常多,要去查 rfc文档

18,356

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 网络编程
c++c语言开发语言 技术论坛(原bbs)
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧