MOH*_*MED 3 sockets linux bash tcp
我有 2 台 linux 电脑(PC1:内核 3.13.0-37 和 PC2:内核 3.11.0-12)
PC1-------PC2(TCP server port 4410)
Run Code Online (Sandbox Code Playgroud)
从 PC1,我发送一个 TCP 快速打开的 tcp 数据包(快速打开 Cookie 请求)

我期待从带有 TCP 选项(快速打开 Cookie:xxxxxxx)的服务器得到一个类似这样的答案:

但是我得到了一个没有 TCP 选项的 tcp 数据包(快速打开 Cookie:xxxxxxx)。
我想知道我的 PC2 (linux) 上是否需要配置一些东西来激活 TCP Fastt Open 选项。
对于 TCP 服务器,我正在运行一个 php 脚本:
$sock = socket_create(AF_INET, SOCK_STREAM, 0);
// Bind the socket to an address/port
socket_bind($sock, "0.0.0.0", 4410) or die('Could not bind to address');
for(;;) {
// Start listening for connections
socket_listen($sock);
...
}
Run Code Online (Sandbox Code Playgroud)
小智 6
您必须使用以下命令在服务器的侦听套接字中启用 TFO:
int qlen = 5;
setsockopt(fd, SOL_TCP, TCP_FASTOPEN, &qlen, sizeof(qlen));
Run Code Online (Sandbox Code Playgroud)
( https://lwn.net/Articles/508865/ )