I saw this code (in peer.c):<br><br>    outgoingCommand = (ENetOutgoingCommand *) enet_malloc (sizeof (ENetOutgoingCommand));<br><br>but that only allocates an ENetOutgoingCommand struct that has a pointer to the the packet:<br>
<br><i><b>   ENetPacket * packet;</b></i><br>} ENetOutgoingCommand;<br><br>Then it inserts the command into a linked list using  enet_list_insert().<br><br>I don&#39;t see where it allocates space for the packet it&#39;s queuing up.<br>
<br><br><br><br><br><div class="gmail_quote">On Fri, Dec 18, 2009 at 4:38 PM, Lee Salzman <span dir="ltr">&lt;<a href="mailto:lsalzman1@cox.net">lsalzman1@cox.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Packets allocate their own copy of the data, so once you send them, you don&#39;t need to free anything since ENet handles that itself. However, the packets ENet gives to you on RECEIVE events, you must remember to destroy them when you are done with them.<br>

<br>
Lee<div><div></div><div class="h5"><br>
<br>
Jay Sprenkle wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Good afternoon all,<br>
<br>
&lt;Newbie usage question alert&gt;<br>
<br>
After reading through the enet source it appears that when you send a packet of data a structure containing a pointer to the data is queued up to send. If I malloc() or new a buffer, fill it, then send it, how do I know when I can safely delete it? I don&#39;t see an event for sent data, etc.<br>

<br>
Thanks!<br>
<br>
&lt;/Newbie usage question alert&gt;<br>
</blockquote>
<br></div></div>
_______________________________________________<br>
ENet-discuss mailing list<br>
<a href="mailto:ENet-discuss@cubik.org" target="_blank">ENet-discuss@cubik.org</a><br>
<a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Cause united breaks guitars<br><a href="http://www.youtube.com/watch?v=5YGc4zOqozo">http://www.youtube.com/watch?v=5YGc4zOqozo</a><br><br>