You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You don't have to, TCP connections stay connected as long as nothing between both peers puts a timeout on it. You can send a heartbeat over it every X seconds to ensure it is still alive. But aside from that it should just stay connected
TCP/IP connections will be kept alive until one side decides to close the connection. It's perfectly fine to not transmit anything over an idle connection for hours or even days (YMMV).
Note that depending on your network setup, you may have a number of middleboxes between both connection endpoints which may limit the lifetime of a connection. Many load balancers or NAT devices are known to terminate idle connections after a while, a timeout of 60 or 600 seconds is quite common.
If you're experiencing timeouts, you may want to occasionally transmit some data over the connection to keep it alive. Many protocols provide some mechanisms (framing) to support keep-alive or heartbeat messages.
In many cases, closing idle connections can be considered a good thing as it allows freeing up some resources.
How do i keep the tcp connection alive?
The text was updated successfully, but these errors were encountered: