为什么当UDP ASSOCIATE请求到达的TCP连接终止时,socks5 UDP关联终止?

Why socks5 UDP association terminates when the TCP connection that the UDP ASSOCIATE request arrived on terminates?

正如socks5 rfc所说,

A UDP association terminates when the TCP connection that the UDP ASSOCIATE request arrived on terminates.

我想知道,“UDP ASSOCIATE请求到达的TCP连接”不是在超时时终止吗?因为在该 TCP 连接中不需要发送更多数据。

客户端是否应该在该 TCP 连接中发送无意义的数据只是为了在它需要 UDP 关联时保持它的活动?

I wonder, doesn't "the TCP connection that the UDP ASSOCIATE request arrived on" just terminate when it timeouts?

没有。 TCP 连接保持活动状态,作为代理 UDP 套接字仍然有效的信号。没有它,client 无法知道 server 是否仍可访问或 UDP 套接字是否仍在分配。

类似地,如果没有 TCP 连接,服务器 没有其他方法知道 客户端 是否仍然连接。

Should the client send meaningless data in that TCP connection just to keep it alive while it need the UDP association?

没有必要发送无意义的数据。只需保持连接。 TCP有一个内置的keepalive mechanism可以打开。

编辑:值得指出的是 Linux 和 Windows 上的默认 TCP keepalive 时间相当长。请参阅 this 有关针对特定套接字进行调整的方法的问题。