Click here to Skip to main content
15,905,971 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I would like to write a C# Server App for a game, and have two clients, one using C# for windows users, and another in Java for everyone else. I need to know how hard it would be for the Java Client to receive info from the C# Server App.

Main Setup Theory - For the Server I am writing it to update a database every tick, then have the Server send a update command to the clients that are connected, the clients will then update themselves using the a Sql Query. Would this be the best way to do it, or would it be better to have the server send all the info to the Clients?
Posted
Comments
aidin Tajadod 12-Oct-11 19:43pm    
I don't see any problems communicating between clients and your server. you need to implement some sort of protocols on TCP. so every one knows how to talk to the server.
Sergey Alexandrovich Kryukov 12-Oct-11 20:07pm    
I outlined possible compatibility hassles, see also my comment to the OP's comment below.
--SA
aidin Tajadod 12-Oct-11 20:23pm    
you got my 5

1 solution

It depends very much on what kind of data is provided by the server. For the messages from the server, I can see two immediate possibilities: using JSON via System.Runtime.Serialization.Json.DataContractJsonSerializer of .NET side or making you server providing Web Service, so the communication can be done via SOAP and WSDL.
See:
http://en.wikipedia.org/wiki/JSON[^],
http://json.org/[^],
http://msdn.microsoft.com/en-us/library/system.runtime.serialization.json.datacontractjsonserializer.aspx[^],
http://msdn.microsoft.com/en-us/library/ms733127.aspx[^],
http://en.wikipedia.org/wiki/Web_service[^],
http://en.wikipedia.org/wiki/WSDL[^].

As I understand, clients use SQL directly with the database server, so this does not depend on you server.
As this is pretty boring but doable.

—SA
 
Share this answer
 
Comments
aidin Tajadod 12-Oct-11 19:55pm    
My 5
Sergey Alexandrovich Kryukov 12-Oct-11 20:05pm    
Thank you, Aidin.
--SA
Fox536 12-Oct-11 20:01pm    
Ok I will look into the tutorials you posted, communicating through binary serialization is how I was going to send the update command for the C# clients as well lol. And yes the clients will be able to use the Sql Queries by themselves so that should be easy, unless you know a better way.
Sergey Alexandrovich Kryukov 12-Oct-11 20:05pm    
When you do serialization, the main obstacle will be obtaining identical data types on .NET and Java sides, compatible serialization is easier half of this problem; this is where Web Services and WSDL have some benefits.

If you agree that this makes sense, consider accepting the solution formally (green button) -- thank you.

Good luck.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900