Reputation: 1603
I'm using a tcp socket connection between an iPhone app and a NodeJS server to transmit data in real time. When a client connects to the server, I'm enabling "keep-alive" on the socket to help prevent "silent" disconnects from inactivity.
Are the keep-alive "pings" uni-directional from the server to client? Does the client side of the tcp connection have any inherent intelligence to detect if the pings stopped arriving?
Upvotes: 3
Views: 2166
Reputation: 15788
If you are using TCP keepalives on a Unix socket via socket(), then the server must respond with an ACK or the socket will assume the connection is dead after the timeouts and retries have been reached.
The linked RFC discusses top keepalives:
https://www.rfc-editor.org/rfc/rfc1122#page-101
Upvotes: 3