爲什麼通過websocket的郵件始終以\x00
開頭,並以\xff
結尾,如\x00Your message\xff
?Websockets中 x00和 xff的含義是什麼?
4
A
回答
3
一個字節表示這documentation可以幫助...從部分
摘錄1.2: -
Data is sent in the form of UTF-8 text. Each frame of data starts
with a 0x00 byte and ends with a 0xFF byte, with the UTF-8 text in
between.
The WebSocket protocol uses this framing so that specifications that
use the WebSocket protocol can expose such connections using an
event-based mechanism instead of requiring users of those
specifications to implement buffering and piecing together of
messages manually.
To close the connection cleanly, a frame consisting of just a 0xFF
byte followed by a 0x00 byte is sent from one peer to ask that the
other peer close the connection.
The protocol is designed to support other frame types in future.
Instead of the 0x00 and 0xFF bytes, other bytes might in future be
defined. Frames denoted by bytes that do not have the high bit set
(0x00 to 0x7F) are treated as a stream of bytes terminated by 0xFF.
Frames denoted by bytes that have the high bit set (0x80 to 0xFF)
have a leading length indicator, which is encoded as a series of
7-bit bytes stored in octets with the 8th bit being set for all but
the last byte. The remainder of the frame is then as much data as
was specified. (The closing handshake contains no data and therefore
has a length byte of 0x00.)
0
我不是100%確定這一點,但我的猜測是表示消息的開始和結束。由於X00是0單字節表示和XFF是255
2
工作規範有改變,不再使用0x00到0xFF的開始和結束字節
http://tools.ietf.org/id/draft-ietf-hybi-thewebsocketprotocol-04.html
相關問題
- 1. \ x00在二進制文件中的含義是什麼?
- 2. \\ x80 - \\ xFF指的是什麼?
- 3. 這個'\ x00 \ x00 \ x00 \ x05'是什麼編碼?
- 4. 什麼是\ X00 \ X04在PHP
- 5. Hbase表填充了scala代碼中值= \ x00 \ x00 \ x00 \ x00 \ x00 \ x00 \ x00 \ x00 \ x00
- 6. \ x1a字符的含義是什麼
- 7. 是什麼含義 - >和Perl中
- 8. x00,xEF,xC8 - 這些是什麼格式?
- 9. ASP.NET AutoEventWireup和Inherits的含義是什麼?
- 10. struct.pack輸出中字母的含義是什麼?
- 11. SOD和SOX的含義是什麼?
- 12. 「error_subcode」的含義是什麼
- 13. DFA的含義是什麼?
- 14. * cast *和* conversion *的含義是什麼?
- 15. ?的含義是什麼?和??運營商
- 16. __stdcall的含義和用法是什麼?
- 17. 什麼是「。@ checked」的含義和調用?
- 18. #+:和#的含義是什麼#::in common lisp
- 19. ui.draggable.draggable的含義是什麼?
- 20. view.bounds.origin的含義是什麼?
- 21. SootMethod.getSubSignature()的含義是什麼?
- 22. URL的含義是什麼
- 23. if(';')的含義是什麼?
- 24. configureDefaultServletHandling的含義是什麼?
- 25. DTMobileIS的含義是什麼?
- 26. android:backgroundDimAmount的含義是什麼?
- 27. 什麼是java.io.tmp的含義
- 28. !int_variable--?的含義是什麼!
- 29. 什麼是WindowsIdentity的含義
- 30. CronJobs的含義是什麼?
我不知道,但大多數弦系統,在那裏一重新null終止,null是一個\ x00,你可能會看到它相反嗎? (即:您的訊息\ xff \ x00) – Christian 2011-01-31 01:07:56