[ENet-discuss] sending a packet

Marc Rochel marc.rochel at udicom.de
Thu Apr 2 22:22:40 PDT 2009


Hi Lee,

ic.

Best regards
	Marc

-----Original Message-----
From: enet-discuss-bounces at cubik.org
[mailto:enet-discuss-bounces at cubik.org] On Behalf Of Lee Salzman
Sent: Freitag, 3. April 2009 13:23
To: Discussion of the ENet library
Subject: Re: [ENet-discuss] sending a packet

Packets are referenced counted, so once you give it to enet_peer_send() 
that increments its reference count by 1. It deletes when reference 
count hits zero. Reference counts are decremented when the packet is 
actually sent and no longer needed on that peer.

enet_packet_create() makes a copy of the data unless you use 
ENET_PACKET_FLAG_NO_ALLOCATE, in which case there is no copy. 
enet_peer_send() never copies anything, though, which was the claim.
  
Lee

Marc Rochel wrote:
> Hi Lee,
>
> really? I do
>
> 				ENetPacket * packet =
> enet_packet_create(p, pn, sendoptions);
>
> 				ret = enet_peer_send(peer, channel,
> packet);
>
> and don't care about the packet or callbacks anyfurther. Also p is
> deleted soon after. Maybe I'm wrong, but I thought the callback method
> was added optionally. I also thought enet_packet_create copies the
data.
> How does it work otherwise?
>
> Best regards
>     Marc
>
>
> -----Original Message-----
> From: enet-discuss-bounces at cubik.org
> [mailto:enet-discuss-bounces at cubik.org] On Behalf Of Lee Salzman
> Sent: Freitag, 3. April 2009 08:31
> To: Discussion of the ENet library
> Subject: Re: [ENet-discuss] sending a packet
>
> ENet does not copy the data at all. It simply queues the packet into a
> list.
> You need to use packet->freeCallback to see when it has deleted the
> packet.
>
> Lee
>
> Marc Rochel wrote:
>   
>> Hi Daniel,
>>
>> I remember a discussing a while back about this. I think the current
>> behavior is when you call enet_peer_send it copies the data and you
>>     
> can
>   
>> immediately delete yours. Somehow you can change this, but I don't
>> remember how so it doesn't copy but instead calls the callback when
>>     
> enet
>   
>> doesn't need it anymore.
>>
>> Best regards
>>     Marc
>>
>> -----Original Message-----
>> From: enet-discuss-bounces at cubik.org
>> [mailto:enet-discuss-bounces at cubik.org] On Behalf Of Daniel Aquino
>> Sent: Donnerstag, 2. April 2009 20:54
>> To: Discussion of the ENet library
>> Subject: Re: [ENet-discuss] sending a packet
>>
>> nvm I found ENetPacket->freeCallback in the docs...
>>
>> On Thu, Apr 2, 2009 at 2:07 PM, Daniel Aquino
>> <mr.danielaquino at gmail.com> wrote:
>>   
>>     
>>> If I create a structure to send in the data of a packet.
>>>
>>> Can I cleanup my data after calling enet_peer_send ?
>>>
>>>     
>>>       
>> _______________________________________________
>> ENet-discuss mailing list
>> ENet-discuss at cubik.org
>> http://lists.cubik.org/mailman/listinfo/enet-discuss
>> _______________________________________________
>> ENet-discuss mailing list
>> ENet-discuss at cubik.org
>> http://lists.cubik.org/mailman/listinfo/enet-discuss
>>
>>   
>>     
>
> _______________________________________________
> ENet-discuss mailing list
> ENet-discuss at cubik.org
> http://lists.cubik.org/mailman/listinfo/enet-discuss
> _______________________________________________
> ENet-discuss mailing list
> ENet-discuss at cubik.org
> http://lists.cubik.org/mailman/listinfo/enet-discuss
>
>   

_______________________________________________
ENet-discuss mailing list
ENet-discuss at cubik.org
http://lists.cubik.org/mailman/listinfo/enet-discuss


More information about the ENet-discuss mailing list