0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

TCP > Link > Three standard message formats @ spring > length-header / stx-etx / crlf

Last updated at Posted at 2017-02-21

TCP通信などにおけるデータフォーマットに関して、<CR><LF><STX><ETX>などの使用について疑問に思った。

以下を見つけた。

Three standard message formats are provided for this purpose; you can also provide code for your own custom format.

  • The first of the three standard formats is length-header, in which case a 4 byte length header precedes the data;

  • The second is stx-etx in which the message data is preceded by an STX (0x02) character and terminated with an ETX (0x03) character.

  • The third is crlf in which the message is terminated with a carriage return and line feed (\r\n).

...

The length-header format can also handle binary data. The other two formats can only handle text data (specifcally, data that does not contain characters 0x02 and 0x03 for stx-etx and 0x0d and 0x0a for crlf). This limitation can be avoided by appropriate character escaping techniques in the application layer.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?