Archived

This topic is now archived and is closed to further replies.

spikespiegel

Directplay - C++ client, C# server?

Recommended Posts

hi, does anyone have any experience with this? it would seem packets are sent differently between these two languages. if my client sends the data as a class, is there any way i can make that class in C# and deserialize it from the networkpacket? this is for a school project and my server team is dying to use C# but im thinking this is a pain.. does anyone know if im just not doing this right?

Share this post


Link to post
Share on other sites
(The type of game is irrelevant.) In general, you''ll have to serialize and de-serialize any class/object structures manually. If the client and server are both C++, then you could define a structure X and send(&X, sizeof(X)) and on the other end receive it with a recv(). If you use C# at the other end, you''ll probably have to do some byte manipulating to move the data into a C# class structure.

// CHRIS

Share this post


Link to post
Share on other sites
quote:
Original post by win32mfc
If you use C# at the other end, you''ll probably have to do some byte manipulating to move the data into a C# class structure.

// CHRIS



Right, all i can seem to find is code to pluck values out instead of getting the whole class, i tried using C#''s serialzation but the binary array is missing a header or something like that... i just started playing with it. I guess im looking to see if its easily do-able or if i should stay away from this approach

Share this post


Link to post
Share on other sites
When the .NET serialization stuff serializes something, it adds a bunch of identification data to allow you to easily return the data to the proper classes...

You probably haven't got that information packed in there from the C++ side, so you'll have to manually deserialize the data on the C# side to make sure the decoding matches. Luckily it's not hard

[edited by - Nypyren on October 18, 2003 3:50:07 PM]

Share this post


Link to post
Share on other sites