NetworkMgr::SendUnreliablePacket
Defined in:
Sends an unreliable packet to 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
NetworkResult SendUnreliablePacket(const NetworkAddress& to, uint32 size, const void *data);
Parameters
to |
The destination address. |
size |
The size of the data packet. This value may not exceed the maximum size given by the constant kMaxMessageSize .
|
data |
A pointer to the data to be sent. |
Description
The SendUnreliablePacket
function sends a data packet to the machine whose address is given by the to
parameter, but does not guarantee delivery. The return value is one of the following network result codes.
kNetworkOkay |
The packet was successfully queued for transmission. |
kNetworkNoConnection |
The operation failed because the address specified by the to parameter does not correspond to any current network connection.
|
kNetworkPacketTooLarge |
The packet could not be sent because its size exceeds kMaxMessageSize .
|
kNetworkBufferFull |
The packet could not be sent because the outgoing packet buffers are full. Try sending the packet again at a later time. |
SendUnreliablePacket
function can be used to send messages to it. Connections are established at the Network Manager level by calling the NetworkMgr::Connect
function.Unreliable packets are used for "fire and forget" messages. Once sent, an unreliable packet is no longer tracked by the sending machine, and the receiving machine does not return an acknowledgement. Delivery of an unreliable packet is not guaranteed, but the Network Manager does ensure that unreliable packets are received in the same order in which they were sent. (This is done by ignoring any unreliable packets sent earlier than the one most recently received.)
Packet data is encrypted before it is transmitted.
See Also
NetworkMgr::SendReliablePacket
NetworkMgr::SendUnorderedPacket