This project has moved. For the latest updates, please go here.

[en] Forced disconnect by the server initiative (solved)

Topics: Technical Support
Sep 4, 2014 at 7:05 AM
Edited Sep 4, 2014 at 8:07 AM
How can i disconnect certain client on the server side in the right way?
I was tought, that SessionManager.TerminateSession, would help me... besides with
catching InvalidSessionException, and count it as a forced disconnect?

...but is it a correct approach?
Sep 7, 2014 at 3:14 PM

There is no such a thing as a forced disconnection, so you are free to implement it in any manner suitable for your application.
I don't see anything wrong with your approach, however, I would prefer something more user-friendly.
Let's just think what do you want your user to see?

If you need your game client to stop and report that the user has been disconnected by server,
all you need is an event on your game interface, such as:
public interface IGameSession
     event EventHandler DisconnectedByServer;
Your game client receives an event, displays a message box and disposes of the connection instance, that's all.