Do I need to heartbeat to keep a TCP connection open?

前端 未结 15 2047
温柔的废话
温柔的废话 2020-11-27 09:56

I have two components that that communicate via TCP/IP. Component A acts as a server/listener and Component B is the client. The two should communicate as quickly as possi

15条回答
  •  离开以前
    2020-11-27 10:06

    You don't need to send heartbeats yourself. The TCP connection will remain open regardless of usage.

    Note that TCP implements an optional keepalive mechanism, which can be used to identify a closed connection in a timely fashion, rather than requiring you to send data at some later date and only then discover the connection is closed.

提交回复
热议问题