C4 Engine
C4 Engine API Documentation

MessageMgr::DisconnectAll

Defined in:  C4Messages.h
Terminates all current connections.
Prototype

void DisconnectAll(void);

Description
On a server machine, calling the DisconnectAll function disconnects all current clients. 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.

On client machines, calling the DisconnectAll function disconnects from the server machine. This is equivalent to calling MessageMgr::Disconnect with the player associated with the server machine. In this case, 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.

If there are no current connections, then calling DisconnectAll has no effect.
See Also

MessageMgr::Connect

MessageMgr::Disconnect

Application::HandleConnectionEvent

Application::HandlePlayerEvent