The name may somehow be missing it&#39;s terminator (&#39;\0&#39;), check if you&#39;re correctly sending it and if you even received it in the first place.<br><br><div class="gmail_quote">On Mon, Jan 26, 2009 at 1:28 AM, Andrew Fenn <span dir="ltr">&lt;<a href="mailto:andrewfenn@gmail.com">andrewfenn@gmail.com</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;">I&#39;ve been reading through any information related to enet on if this<br>
is possible and have decided to give up and ask on the mailing list.<br>
<br>
typedef struct {<br>
 &nbsp; &nbsp;char name[40]; &nbsp; &nbsp; &nbsp; /* Players name */<br>
 &nbsp; &nbsp;enet_uint32 conState; &nbsp;/* Connection state */<br>
} Player;<br>
<br>
I have the following server side code..<br>
<br>
// enet event, data, data size, channel, priority<br>
message(mEvent.peer,&amp;player,sizeof(player),0,ENET_PACKET_FLAG_RELIABLE);<br>
<br>
I have the following client side code..<br>
<br>
Player player;<br>
memcpy(&amp;player, event.packet-&gt;data, sizeof(Player));<br>
printf(&quot;Packet contains name: \&quot;%s\&quot; connection state: 0x%08x was<br>
inside.\n&quot;, <a href="http://player.name" target="_blank">player.name</a>, player.conState);<br>
<br>
When sending and receiving the size is the same (44 bytes), however<br>
when the data arrives <a href="http://player.name" target="_blank">player.name</a> has garbage around the data.<br>
(player.conState is fine).<br>
<br>
My question is, what is the correct way of doing this?<br>
<br>
Regards,<br>
Andrew<br>
_______________________________________________<br>
ENet-discuss mailing list<br>
<a href="mailto:ENet-discuss@cubik.org">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>