I was wondering how to send packet to client in client-server architecture with RakNet. In this sample code we have this line:
peer->Send(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,packet->systemAddress,false);
However, the prototype is the following (from the interface class):
virtual uint32_t Send( const RakNet::BitStream * bitStream,
PacketPriority priority,
PacketReliability reliability,
char orderingChannel,
const AddressOrGUID systemIdentifier,
bool broadcast,
uint32_t forceReceiptNumber=0 )=0;
As you can see, the 5th parameter takes a AddressOrGUID, it means we can send the SystemAddress as in the sample, but also can send the unique GUID of a connected machine.
There is a function called:
RakNet::GetSystemAddressFromGUID();
But I'm not sure if RakNet uses it to convert the GUID we can send as a parameter (I didn't find any use of this method in RakPeer (implemention of RakPeerInterface) and I'm not able to find how buffered packet are sent each tick).
The problem is the following:
The sample code replies directly to the received packet. However, in a game, server has to send information without receiving packet from client. So I don't have access to something like
packet->systemAddress
because there is no received packet.
So I will have to stock something in my Player class to know how to send them packets: SystemAddress or RakNetGUID. RakNetGUID is simpler and lighter to stock than a SystemAddress.
But, if RakNet uses GetSystemAddressFromGUID(), it's not worth because is has a O(log(n)) algorithm.
Do I need to stock the SystemAddress for each Player myself or RakNet::Send() doesn't use this method with a RakNetGUID ?
Thank you!