network object
This method will send a reliable packet to a given peer.
bool send_reliable(uint peer_id, string packet, int channel)
Parameters:
peer_id
The unique ID of the peer that is to receive the message.
packet
The message to be sent.
channel
The channel that the message should be sent on.
Return value:
true on success, false on failure.
Remarks:
This method sends a reliable packet to a given peer, or to all connected peers if the peer ID is set to 0.
Reliable packets are always guaranteed to get through, and always in the proper order just like unreliable ones. This reliability comes at a cost, however. Since the internet is unreliable by nature, BGT needs to wait for an acknowledgement from the other person to say that the packet was in fact received. If no such acknowledgement is received within a reasonable amount of time, a new attempt to send the packet is made. The same procedure is repeated over and over again until an acknowledgement is received, or until enough time has elapsed to deem the connection as dead. This may cause considerable delays in the transmition as compared to unreliable packets, and should thus only be used for things where speed is not critical.
For more information about the differences between unreliable and reliable packets, as well as information about how to sequence packets using channels, see the main network chapter.
Example:
See the main network chapter.