C# Exit question
hello friends, I am developing a project in c# and when it is closed from the task manager, I cannot get my session module to exit because it exits urgently. I want to run my sessionend void in unexpected situations, but I have no idea how to do it.
9 Replies
If someone does "End task" from task manager, or powers off their computer, there's nothing you can do: your application will simply stop. You need to design you application to cope with this possibility.
the 'end task' thing exists purely to solve cases where your application stops responding even to the shutdown request
if your 'sessionend' function gets stuck and never returns, the program would never be able to exit
the 'end task' /
taskkill /f
is there to solve exactly that purpose
what is this 'session module'? why do you need to clean it up before exit?
what kind of things are you cleaning up?
what kind of application is this?I am developing a launcher for a game, when the player logs in, I activate the session from the api and when he logs out, I want to close it back. If he closes it from the task manager, it will still appear online because the session remains open.
from the client, periodically send some sort of heartbeat to the server; on the server, make the user offline if the heartbeat is lost for a certain amount of time?
Shouldn't I add a listener to the api for this? I think it will force me.
errrrr not sure what you mean by that
I'm not sure how to do what you're saying.
I suppose you're making the server app as well?
No, I don't, I have it custom-made.