[ENet-discuss] sent reliable packet
Benoit Germain
bnt.germain at gmail.com
Mon Feb 25 07:04:13 PST 2013
2013/2/25 BS Flasher <bsflasher at gmail.com>
> Hi,
> Thanks for quick answer but I don't understand your mean of refcount !
> Can you please send some code about your solution?
>
// starts with packet->referenceCount set to 0
ENetPacket* packet = enet_packet_create( ...);
++ packet->referenceCount;
store_pointer_somewhere( packet);
// increments packet->referenceCount
enet_packet_send( peer, packet, ...
Then later, scan all stored ENetPacket pointers; Each packet with
referenceCount == 1 was received. Do what you want, and don't forget to
call enet_packet_destroy(), since ENet didn't do it for you (because
refcount didn't go down to 0 inside enet_host_service().
Also, is there another way to check acknowledgement of every packet?
>
Not that I know of. But it is simple enough :-).
--
Benoit.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubik.org/pipermail/enet-discuss/attachments/20130225/63ceff21/attachment.html>
More information about the ENet-discuss
mailing list