# Check if client is alive

I am having client/server application and i want to detect if client is alive.

So i know that send() will return me null but it will not inform my server that client has been disconnected.

Way i came up is each N seconds send "Are you alive" message from server to client but is that good solution?

• This is called a keepalive. Have you observed any problems with using this approach? – DMGregory Jan 14 at 4:39
• No and i am doing it like that but somewhere i read it is not good idea to do it like that so wanted to ask what is other solution – Aleksa Ristic Jan 14 at 11:11
• Who said it was not good, and why? We can solve a problem better if we know what problem it is we're solving. – DMGregory Jan 14 at 12:42