NetworkMgr::Disconnect
Defined in:
Terminates a connection with another machine.
C4Network.h
NOTE. This is a low-level function that is normally called exclusively by the Message Manager. Calling this function directly is not recommended if the Message Manager is being used.
Prototype
void Disconnect(const NetworkAddress& address);
Parameters
address |
The address of the machine with which to terminate a connection. |
Description
The Disconnect
function terminates the connection with the machine whose address is given by the address
parameter. If no connection to this address exists, then the Disconnect
function has no effect.When a server receives a disconnect message from a client, the Network Manager on the server calls the currently installed network event procedure, if any. The low-level network event procedure can be set using the
NetworkMgr::SetNetworkEventCallback
function, but this procedure should not be changed if the Message Manager is being used. Instead, the Message Manager on the server and on each remaining client in the game calls the Application::HandlePlayerEvent
function to inform the application modules on those machines that a player has departed.The Network Manager attempts to disconnect in an orderly fashion by listening for an acknowledgement to the disconnection message. The number of attempts to disconnect and the time interval between these attempts are the same as those used for reliable packet transmission. These values can be changed using the
NetworkMgr::SetReliableResendCount
and NetworkMgr::SetReliableResendTime
functions.
See Also