NetworkMgr::ReceivePacket
Defined in:
Retrieves the next available incoming data packet.
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
NetworkResult ReceivePacket(NetworkAddress *from, uint32 *size, void *data);
Parameters
from |
A pointer to a NetworkAddress structure that will be filled with the address of the machine from which the message originated.
|
size |
A pointer to an uint32 that will be filled with the size of the message.
|
data |
A pointer to a buffer that will receive the packet data. This buffer must be at least kMaxMessageSize bytes in length.
|
Description
The ReceivePacket
function retrieves the least recently received incoming data packet from any network address. The return value is one of the following network result codes.
kNetworkOkay |
A packet was received and has been copied into the buffer pointed to by the data parameter.
|
kNetworkNoPacket |
There is no incoming packet to be received. |
data
parameter. The size that is written to the variable pointed to by the size
parameter is always at least one byte and at most kMaxMessageSize
bytes.
See Also
NetworkMgr::SendReliablePacket
NetworkMgr::SendUnreliablePacket