C4 Engine
C4 Engine API Documentation

NetworkMgr::SendUnorderedPacket

Defined in:  C4Network.h
Sends an unordered packet to another machine.
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 SendUnorderedPacket(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 SendUnorderedPacket function sends a data packet to the machine whose address is given by the to parameter, but does not guarantee delivery and does not guarantee in-order 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.
A connection must be established with a machine before the SendUnorderedPacket function can be used to send messages to it. Connections are established at the Network Manager level by calling the NetworkMgr::Connect function.

Unordered packets are used for "fire and forget" messages for which the order of receipt is not important. Once sent, an unordered packet is no longer tracked by the sending machine, and the receiving machine does not return an acknowledgement. Delivery of an unordered packet is not guaranteed, and unlike unreliable packets, the Network Manager does not ensure that unordered packets are received in the same order in which they were sent.

Packet data is encrypted before it is transmitted.
See Also

NetworkAddress

NetworkMgr::SendReliablePacket

NetworkMgr::SendUnreliablePacket

NetworkMgr::SendConnectionlessPacket

NetworkMgr::BroadcastPacket

NetworkMgr::ReceivePacket

NetworkMgr::Connect