keepalive的典型用法是什么

keepalive的典型用法是什么

本文介绍了TCP keepalive的典型用法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请考虑存在一个服务器和多个客户端的情况.每个客户端创建TCP连接以与服务器交互. TCP活着有三种用法:

Consider a scenario where exists one server and multiple clients. And each client creates TCP connections to interact with the server. There are three usages of TCP alive:

  1. 服务器端keepalive:服务器发送TCP keepalive以确保客户端处于活动状态.如果客户端已死,则服务器将关闭与客户端的TCP连接.
  2. 客户端的保持活动状态:客户端发送TCP保持活动状态,以防止服务器关闭与客户端的TCP连接.
  3. 双方keepalive:服务器和客户端均按照1和2中的说明发送TCP keepalive.

以上典型的TCP keepalive用法是什么?

Which of the above usages of TCP keepalive are typical?

推荐答案

如果客户端已死,则服务器会在连接后 出现连接重置"错误.

If the client is dead, the server gets a 'connection reset' error, after which it should close the connection.

不.客户端发送keepalive,以便如果服务器已死,则客户端将收到连接重置"错误,然后应关闭连接.

No. Client sends keepalive so that if the server is dead, the client will get a 'connection reset' error, after which it should close the connection.

如上所述,由于keepalive失败,双方都能进行连接重置".

Both sides are capable of getting a 'connection reset' due to keepalive failure, as above.

其中任何一个,或者一个都没有.如果对等方定期发送消息,则也实际上不需要保持活动状态.因此,对于服务器而言,它通常比客户机更有用.

Any of them, or none. If a peer is sending regularly it doesn't really need keepalive as well. It is therefore often of more use to a server than a client.

这篇关于TCP keepalive的典型用法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 04:18