Advertisement

Directplay - C++ client, C# server?

Started by October 14, 2003 03:56 PM
4 comments, last by spikespiegel 21 years, 3 months ago
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?
Andrew McTeerwww.bitporters.net
what kind of game is it?
Advertisement
(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
// CHRIS [win32mfc]
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
Andrew McTeerwww.bitporters.net
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]
right, thanks guys! thats what im doing now.

Just wanted to see if i was walking into a nightmare or not:D
Andrew McTeerwww.bitporters.net

This topic is closed to new replies.

Advertisement