C4 Engine
C4 Engine API Documentation

MessageMgr::Disconnect

Defined in:  C4Messages.h
Terminates a connection with a server.
Prototype

void Disconnect(Player *player);

Parameters
player A pointer to a player from which to disconnect.
Description
When the Disconnect function is called, the Message Manager terminates the connection with the machine associated with the player parameter. On client machines, if this player does not represent the server, then the Disconnect function has no effect.

When a client disconnects from the server, the Application::HandleConnectionEvent function is called with the kConnectionClientClosed event to notify the application module that the connection to the server has been terminated. The Message Manager on the server and on each remaining client in the game calls the Application::HandlePlayerEvent function with the kPlayerDisconnected event to inform the application modules on those machines that a player has departed.

When a server machine disconnects a client, the Application::HandleConnectionEvent function is called with the kConnectionServerClosed event on the client machine to inform the application module that is has been disconnected by the server.
See Also

MessageMgr::Connect

MessageMgr::DisconnectAll

Application::HandleConnectionEvent

Application::HandlePlayerEvent