I'm working on a client/server game and am looking for ways for the client to detect whether it is still connected to the server, like for example when the server is power down. Right now all I can think of is passing a token over time from server to client to tell the client that it is still connected. What I want to ask is whether anyone can tell me a better way of doing server connection checks. Can someone please give me some advise?
Asked
Active
Viewed 30 times
0
-
**How** are you connected? E.g. is there a TCP connection? – derHugo Sep 17 '20 at 07:12
-
Yes, on the server I have a tcp listener and on the client side I am using socket to connect – Ken Sep 17 '20 at 11:51
-
then you could probably use something like [this](https://stackoverflow.com/q/1387459/7111561). Instead of a passive receiving timer you simply can check continuously active if the server is still connected – derHugo Sep 17 '20 at 12:08
-
Ok, I'll check this out first then. Thx – Ken Sep 17 '20 at 14:13