FTP协议中的转义字符

时间:2012-12-07 10:22:29

标签: c ftp

我目前正在我的一个项目(ftp客户端部分)上实现ftp协议。我正在关注RFC959

在这个RFC中,我遇到了一个问题:转义字符,实际上,它描述了必须使用转义字符。但我不知道具体的角色是什么。

以下是有关转义字符的RFC部分:

     3.4.1.  STREAM MODE

     The data is transmitted as a stream of bytes.  There is no
     restriction on the representation type used; record structures
     are allowed.

     In a record structured file EOR and EOF will each be indicated
     by a two-byte control code.  The first byte of the control code
     will be all ones, the escape character.  The second byte will
     have the low order bit on and zeros elsewhere for EOR and the
     second low order bit on for EOF; that is, the byte will have
     value 1 for EOR and value 2 for EOF.  EOR and EOF may be
     indicated together on the last byte transmitted by turning both
     low order bits on (i.e., the value 3).  If a byte of all ones
     was intended to be sent as data, it should be repeated in the
     second byte of the control code.

     If the structure is a file structure, the EOF is indicated by
     the sending host closing the data connection and all bytes are
     data bytes.

有谁知道角色是什么?

一般情况下,您是否有一些关于如何告诉FTP服务器我已完成发送文件的线索?

先谢谢你。

1 个答案:

答案 0 :(得分:5)

“控制代码的第一个字节将是全部,即转义字符。” - 换句话说 - 0xff