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

前端 未结 15 2051
温柔的废话
温柔的废话 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条回答
  •  -上瘾入骨i
    2020-11-27 10:19

    If your using windows, be cautious about the TCP Keep-alive. By default, its disabled unless you either turn it on globally with the windows registry or via setsockopt.

    The default keep-alive interval is 2 hours.

    http://msdn.microsoft.com/en-us/library/ms819735.aspx

    You might need to implement your own heart beat and disable TCP keep-alive on windows if the 2 hour keep-alive alive is not desirable.

提交回复
热议问题