Disconnect Method  

Disconnect the specified client session from the server.


object.Disconnect( ClientId )


An integer that identifies the client session.

Return Value

A value of zero is returned if the client was signaled to terminate its connection to the server. Otherwise, a non-zero error code is returned which indicates the cause of the failure.


This method terminates the specified client connection, releasing the socket handle other resources that were allocated for the session. It is only necessary to use this method if you want the server to explicitly terminate a client connection. Normally the client will close its connection to the server, the OnDisconnect event will fire and the server will automatically disconnect the client.

The thread that is managing the client will be signaled that it should disconnect from the server, and it will begin the process of terminating the session. This is an asynchronous process and it is not guaranteed that the client will have actually disconnected from the server at the time that this method returns to the caller.

See Also

Start Method, Stop Method, OnConnect Event, OnDisconnect Event