C4 Engine
C4 Engine API Documentation

NetworkMgr::BroadcastPacket

Defined in:  C4Network.h
Broadcasts a data packet on the LAN.
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 BroadcastPacket(uint32 size, const void *data);

Parameters
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 BroadcastPacket function broadcasts a connectionless data packet to the local area network. The return value is one of the following network result codes.
kNetworkOkay The packet was successfully queued for transmission.
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.
Delivery of a connectionless packet is not guaranteed, and connectionless packets may be received in an order different from which they were sent.

Broadcasted packets are sent to the broadcast port number, which can be set using the NetworkMgr::SetBroadcastPortNumber function.

Packet data is encrypted before it is transmitted.
See Also

NetworkAddress

NetworkMgr::GetBroadcastPortNumber

NetworkMgr::SetBroadcastPortNumber

NetworkMgr::SendReliablePacket

NetworkMgr::SendUnreliablePacket

NetworkMgr::SendUnorderedPacket

NetworkMgr::SendConnectionlessPacket

NetworkMgr::ReceivePacket