通常使用环形缓冲区,所有数据接收将在环形缓冲区中排队,主回路检查头和尾指针。
如果你知道字节总数是一个固定数,那么只需在接收字节数时进行解码,如果是正确的,然后将字节发送出去。
以上来自于百度翻译
以下为原文
I normally use a ring buffer, all data receive would be queue up in the ring buffer and the main loop inspect the head and tail pointer.
if you know the total number of bytes is a fix number, then just do the decoding when the number of bytes received, and if that is correct then send the bytes out.
通常使用环形缓冲区,所有数据接收将在环形缓冲区中排队,主回路检查头和尾指针。
如果你知道字节总数是一个固定数,那么只需在接收字节数时进行解码,如果是正确的,然后将字节发送出去。
以上来自于百度翻译
以下为原文
I normally use a ring buffer, all data receive would be queue up in the ring buffer and the main loop inspect the head and tail pointer.
if you know the total number of bytes is a fix number, then just do the decoding when the number of bytes received, and if that is correct then send the bytes out.
举报