Answer the question
In order to leave comments, you need to log in
How to catch incorrect server shutdown?
I catch the exit from the program through an event using ConsoleEvent:
public enum ConsoleEvent
{
CTRL_C = 0,
CTRL_BREAK = 1,
CTRL_CLOSE = 2,
CTRL_LOGOFF = 5,
CTRL_SHUTDOWN = 6
}
Answer the question
In order to leave comments, you need to log in
We will assume that we are talking about a client and a server in the context of interaction via the TCP protocol (if not, please specify the question).
Tell the client that the server is shutting down normally, and the client will know it makes sense to reconnect. If the server disconnects and does not send such a message, the client considers that the server has shut down abnormally and does not reconnect. Moreover, you can tell the client in how many seconds/minutes/hours you can connect to the server again - the client will not take a steam bath and knock on the closed gate until the server has risen yet.
No way.
The process can be assured or put to sleep, and no one will report anything.
Only if there is another process that will monitor the first one.
Well, I don’t know, I personally use the NetSockets library and everything is very conveniently implemented there, look in its direction.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question