Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问KCP中是否使用了冗余校验? #23

Closed
nifflin opened this issue May 24, 2016 · 1 comment
Closed

请问KCP中是否使用了冗余校验? #23

nifflin opened this issue May 24, 2016 · 1 comment

Comments

@nifflin
Copy link

nifflin commented May 24, 2016

TCP中使用了冗余校验,可以减少重传,而KCP的文档中貌似没有提及任何冗余校验机制,那我就估计KCP没有使用冗余校验。如果确实没有使用,那么请问这是为什么?谢谢!

@skywind3000
Copy link
Owner

tcp的冗余校验只是个CRC而已,判断是否合法,不合法就直接当丢包处理,并不能减少重传,这部分实现一般会紧贴传输层来实现,比如KCP要使用起来你本身就需要写一个udp的传输会话管理模块,而UDP本身就已经带了CRC校验了,所以没必要做到KCP中,很多人也会选择自己再做一层CRC,但是一般也是做到UDP传输管理模块中。

你想说的是冗余编码吧和前向纠错吧,https://github.com/skywind3000/kcp/wiki/KCP-Best-Practice 我这里讨论过。

要做冗余编码或者前向纠错的话,一般会设计另外一层协议来实现,即把kcp的输出接到那层协议的输入,协议栈嘛,协议设计最好的模型是分层,自由灵活组合,没必要所有东西搅在一起,比如我自己用的都是三层协议:

会话管理层:面向用户
KCP层:为会话管理层提供I/O接口
传输层:前向纠错
UDP层:CRC校验,加密收发等。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants