ASP.NET:实现客户端服务器解决方案(用于聊天,反复打架等)客户端、解决方案、服务器、ASP

2023-09-10 19:01:59 作者:拾心

我有一个非常先进的应用程序,在这里我需要添加一些客户端/服务器功能。功能性的一些例子是:

I have a quite advanced application, where I need to add some client/server functionality. Some examples of functionalities is:

聊天 在一个网页游戏一对比一拼 在画人在地图

我在创建ASP.NET和AJAX这个应用程序。我不使用Silverlight / Java小程序/ Flash或其他任何东西。如果可能的话,我不想改变这种出于其他原因。

I am creating this application in ASP.NET and AJAX. I do not use Silverlight/Java Applet/Flash or anything else. If possible, I do not want to change this for other reasons.

我想过创造某种游戏服务器,然后沟通或者Web服务或TCP协议:但我不知道这是否是一个好主意。另外,我不知道如何做到这一点。

I thought about creating some kind of game server, and then communicating either web services or TCP protocol: But I have NO idea if this is a good idea. Also, I don't know how to do this.

所以我的问题是: 什么是实现这一目标的最佳方式是什么?而且是它甚至可能吗?而如果是,你能不能给一个或两个参考?

So my question is: What's the best way to implement this? And is it even possible? And if it is, could you give a reference or two?

非常感谢

拉​​尔斯

推荐答案

有关做聊天和放大器;多人游戏,问题的关键是获得服务器异步消息发送到客户端。这可以通过一个称为反向的Ajax(或commet)方法来实现。下面是一个简单的例子,如何做反向Ajax和ASP.NET。这是一个非常棘手的概念(至少在我们可以使用HTML5 WebSockets的),用了很多心思进入安全问题等。我认为问这个问题,你都已经比较熟悉了阿贾克斯和放大器;浏览器脚本(如果没有,你有很多的阅尽)。

For doing chat & multiplayer games, the crux of the problem is in getting the server to asynchronously send messages to the client. This can be accomplished by a method called reverse-Ajax (or commet). Here is a simple example for how to do reverse-Ajax with ASP.NET. This is a very involved concept (at least until we can use HTML5 WebSockets) with a lot of thought going into security concerns, et al. I assume that by asking this question you are already quite familiar with Ajax & browser scripting (if not, you have a lot of reading to do).