NetworkMgr::SetPortNumber
Defined in:
Sets the port number on which the local machine will send and receive communications.
C4Network.h
Prototype
void SetPortNumber(uint16 port);
Parameters
port |
The 16-bit port number. |
Description
The port number passed to the SetPortNumber
function is the port number that the Network Manager will attempt to use upon initialization. Servers should generally call SetPortNumber
, specifying a port number on which client applications will expect it to be listening, before the Network Manager is initialized. Clients may specify a port number of zero, in which case the Network Manager allows the underlying TCP/IP implementation to select an available port. The port number is set to zero by default.Calls to
SetPortNumber
that occur after the Network Manager has been initialized do not change the port on which communications occur. In order to make this change, one must terminate the Network Manager (by calling NetworkMgr::Terminate
), set a new port number, and then reinitialize the Network Manager (by calling NetworkMgr::Initialize
).
See Also
NetworkMgr::GetBroadcastPortNumber