In network applications, there is such a thing when a client sends a test message to the server to the client on a timer to check whether it has fallen off. So how is it more logical? To server to client or client to server?

UPD. Details on my application. I'm writing a chat. Simple text chat. And, accordingly, that party who will send messages also checks, thus, whether the receiving party has fallen off. For example, the client sends messages to the server, but if the server is cut down, it will receive an error when it is called, and this is also an indicator that the server has been cut down. And the server, respectively, simply waits to receive a test message and if it does not receive it removes the client from the connected ones. Well, and vice versa if the receiving party is a client

  • I do not understand client-server applications, but as for me, I have to start from a specific task. For example, I would think like this: if a client needs to periodically check something on the server, the client sends a message. If this is some kind of MMO, then in theory the server itself should already send a request to know if the user has dropped off (afk). If you fell off - throw out the appropriate message above it. Although here you can make the request from the user go. All to your taste. :) - intro94

1 answer 1

The answer lies in the details of the product that you are developing, or rather the nodes in your infrastructure, in other words - draw how many clients and servers you have and do not understand everything yourself:

UPD: in your case I would not close the connection to the server

  • updated the question. Server one yes. And customers can be as many as you want. I did not limit it. - PECHAIRMINE
  • in your case I would not close the connection to the server - Stranger in the Q
  • In the sense of not closing? When did not close? - PECHAIRMINE
  • nodes after communicating via a socket can either close it or not close it, if it is not closed, then you do not need to establish a connection to retry the data - Stranger in the Q
  • Well, firstly I use WCF. And secondly, I again do not understand what you mean ... In what place can they close or not close ??? - PECHAIRMINE