You should make an enum of some sort to identify data types if you need to. e.g.:<br>enum GameDataTypes { GDT_STRING, GDT_FLOAT, GDT_DOUBLE, GDT_INT, GDT_LOGIN_STRUCT, GDT_MOVEMENT_SAMPLE, ... }<br>And do some array work to actually compose your packets. E:g.:<br>
<br>MemoryStream Packet;<br>Packet.Write&lt;unsigned long&gt;(ID);<br>Packet.Write&lt;String&gt;(WorldName);<br>....<br><br>I actually just write do the second part of this (ID + data), but i never did get to test it much out there since my game&#39;s still not complete altho some of the network code was done.<br>
<br><div class="gmail_quote">On Sun, Jan 17, 2010 at 7:54 PM, Alex Milstead <span dir="ltr">&lt;<a href="mailto:alex.milstead@gatech.edu">alex.milstead@gatech.edu</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;">
In that case, is there a solid way to extract that identifier? Or will I need to do some I&#39;m aware of sprintf calls, is it common practice to simply &quot;sprintf&quot; the first integer of the received binary data into a buffer and (effectively) switch-case on that buffer, then memcpy the remaining data that follows? Or is there a better way of doing this?<br>

<br>
Cheers,<br><font color="#888888">
Alex</font><div><div></div><div class="h5"><br>
<br>
On Jan 17, 2010, at 2:39 PM, Thorbjørn Lindeijer &lt;<a href="mailto:bjorn@lindeijer.nl" target="_blank">bjorn@lindeijer.nl</a>&gt; wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Sun, Jan 17, 2010 at 19:50, Alex Milstead &lt;<a href="mailto:alex.milstead@gatech.edu" target="_blank">alex.milstead@gatech.edu</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Also, Jay you mentioned earlier that it was easy to do simple data-type<br>
checking on the receiving end. I&#39;m a bit of a fledgling network programmer<br>
-- I&#39;m still definitely becoming more acquainted the vast amount of<br>
unfamiliar programming techniques in this particular arena. The only<br>
surefire type-checking system I know about in programming is in java (=/),<br>
with it&#39;s &quot;instanceof&quot; operator. As far as I know this type of mechanism, or<br>
anything similar, doesn&#39;t really exist in C/C++. So my next question is, if<br>
we&#39;re sending binary data along and receiving it as binary data, what&#39;s the<br>
most efficient way of type-checking the probable struct being piped through?<br>
</blockquote>
<br>
You give it a number which designates its type. You&#39;d usually prepend<br>
such a number to each of your messages, so that you know how to<br>
interpret them on the other end.<br>
<br>
Regards,<br>
Bjørn<br>
_______________________________________________<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>
_______________________________________________<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>
</div></div></blockquote></div><br>