i need to know how i can check wheather the server, connected to by the client is still reachable (from the client)and add an exception on internet disconnect. Ive found several results, but there not working fine for me. Something like a keepalive check is done by the server, but theres no option to send keepalive beacons to the server, cause my client is always listening to its server.
You can call setsockopt() to enable keep-alive packets. It does not matter if you're client of server. The stack will handle the timeout checking. If the other side does not respond to the keep-alive packet, you will get an error on your next operation. If you have a read pending on the server, the read will terminate immediately with an error. https://docs.microsoft.com/en-us/windows/win32/winsock/so-keepalive