gpt4 book ai didi

linux - 如何在 Linux 中激活 TCP Fast Open

转载 作者:可可西里 更新时间:2023-11-01 02:37:08 32 4
gpt4 key购买 nike

我有 2 台 Linux 电脑(PC1:内核 3.13.0-37 和 PC2:内核 3.11.0-12)

PC1-------PC2(TCP server port 4410)

我从 PC1 发送一个带有 TCP 快速打开(快速打开 Cookie 请求)的 tcp 数据包

enter image description here

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

enter image description here

但是我得到了一个没有TCP选项的tcp包(Fast Open 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);
...
}

最佳答案

您必须在服务器的监听套接字中启用 TFO:

int qlen = 5;
setsockopt(fd, SOL_TCP, TCP_FASTOPEN, &qlen, sizeof(qlen));

( https://lwn.net/Articles/508865/ )

关于linux - 如何在 Linux 中激活 TCP Fast Open,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30079248/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com