我终于找到了导致问题的原因。这是由于我的路由器在我无线连接时阻止了 TCP 保持连接消息(见图)。
ssh my_server -o TCPKeepAlive=no
解决了我所有的问题。好极了!
从文档:
TCPKeepAlive
Specifies whether the system should send TCP keepalive messages
to the other side. If they are sent, death of the connection or
crash of one of the machines will be properly noticed. However,
this means that connections will die if the route is down tem-
porarily, and some people find it annoying. On the other hand,
if TCP keepalives are not sent, sessions may hang indefinitely on
the server, leaving "ghost" users and consuming server resources.
The default is "yes" (to send TCP keepalive messages), and the
server will notice if the network goes down or the client host
crashes. This avoids infinitely hanging sessions.
To disable TCP keepalive messages, the value should be set to
"no".
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3613 次 |
最近记录: |