C4 Engine
C4 Engine API Documentation


Defined in:  C4Network.h
Initializes the Network Manager.
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.

NetworkResult Initialize(void);

The Initialize function attempts to initialize the underlying TCP/IP implementation and prepare the Network Manager for communications. The Initialize function returns one of the following network result codes.
kNetworkOkay The Network Manager was successfully initialized.
kNetworkInitFailed The Network Manager could not be initialized because the operating system returned an error.
If the Network Manager has already been initialized at the time when Initialize is called, then the return value is kNetworkOkay—duplicate calls to Initialize are harmless.

The NetworkMgr::SetPortNumber function should be called before the Initialize function is called to set the port number on which communications will occur. On client machines, the port number may be set to zero to indicate that any available port number may be chosen by the TCP/IP implementation.
See Also