C#服务器应用程序可以与Java客户端通信吗? [英] Can a C# Server App communicate with Java Client?

查看:67
本文介绍了C#服务器应用程序可以与Java客户端通信吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为一个游戏编写一个C#服务器应用程序,并且有两个客户端,一个用于Windows用户,一个使用C#,另一个用于其他所有人的Java.我需要知道Java客户端从C#Server应用程序接收信息的难度.

主要设置理论-对于服务器,我正在编写它以在每次更新时更新数据库,然后让服务器向连接的客户端发送更新命令,然后客户端将使用Sql查询进行自我更新.

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?

推荐答案

这在很大程度上取决于什么这类数据由服务器提供.对于来自服务器的消息,我可以看到两种直接的可能性:通过.NET端的System.Runtime.Serialization.Json.DataContractJsonSerializer使用JSON或使服务器提供Web服务,因此可以通过SOAP和WSDL进行通信. 参见:
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 [
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


这篇关于C#服务器应用程序可以与Java客户端通信吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆