Hri*_*ali 5 linux congestion-control sysctl
linux 中的“sysctl”命令现在全局更改了整个系统的拥塞控制算法。但是拥塞控制,其中 TCP 窗口大小和其他类似参数是变化的,通常是每个 TCP 连接完成的。所以我的问题是:
还是我在这里遗漏了一些微不足道的东西?如果是,那是什么?
这是在iperf 中使用 -Z 选项完成的 - 补丁在这里。
这是它的实现方式(PerfSocket.cpp,第 93 行):
if ( isCongestionControl( inSettings ) ) {
#ifdef TCP_CONGESTION
Socklen_t len = strlen( inSettings->mCongestion ) + 1;
int rc = setsockopt( inSettings->mSock, IPPROTO_TCP, TCP_CONGESTION,
inSettings->mCongestion, len);
if (rc == SOCKET_ERROR ) {
fprintf(stderr, "Attempt to set '%s' congestion control failed: %s\n",
inSettings->mCongestion, strerror(errno));
exit(1);
}
#else
fprintf( stderr, "The -Z option is not available on this operating system\n");
#endif
Run Code Online (Sandbox Code Playgroud)
其中mCongestion是包含要使用的算法名称的字符串