ASP.NET: Implementing a client server solution (for chats, iterative fights ect)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-08 11:26:01

问题


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

  • Chat
  • One vs. one fight in a browser game
  • Draw people on a map

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.

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?

Thanks a lot,

Lars


回答1:


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).




回答2:


Tutorial on writing a basic chat server: (in c# no less) http://www.dreamincode.net/forums/topic/33396-basic-clientserver-chat-application-in-c%23/

Sgive you a good foundation on server development.



来源:https://stackoverflow.com/questions/4557428/asp-net-implementing-a-client-server-solution-for-chats-iterative-fights-ect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!