-
Notifications
You must be signed in to change notification settings - Fork 85
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
为什么test中的实例 和netty的UDP或者TCP直接发送相比,每秒钟发送消息数不如后者多? #10
Comments
这个地方是因为update的时候并没有真的发出去,send后需要等到10ms以后才发。 |
@beykery 那么可否这样理解: |
你改成1ms是没用的,因为最小就是10ms; |
noDelay(int nodelay, int interval, int resend, int nc) |
你说的哪个c#原版? |
https://github.com/skywind3000/kcp 这个啊,kcp的原版。 哦,原版是C++的,记错了 |
这个问题,可以参考原作的这个issue: |
TestServer 和 TestClient 的 handleRecieve 都改为类似
@OverRide
public void handleReceive(ByteBuf bb, KcpOnUdp kcp) {
String content = bb.toString(Charset.forName("utf-8"));
System.out.println("KCP "+ content +System.currentTimeMillis());
kcp.send(bb);// echo
}
互相回发,Client的main函数中 sleep 1s 后调用close() 方法,测试下来Server端可以打印100行左右。
而用Netty直接写UDP测试1s可以打印出近2000行消息,TCP 1s 也可以打印近1800行消息。
造成这种差异的原因,是KCP算法本身调度,和增加了流量大小所致,还是别的原因?
测试DUP 用例:
public class Server {
private static Logger logger = LoggerFactory.getLogger(Server.class);
}
public class Client {
private static Logger logger = LoggerFactory.getLogger(Client.class);
private int scanPort;
}
public class AppConstants {
}
The text was updated successfully, but these errors were encountered: