ASP.NET: Implementing a client server solution (fo

2019-06-14 08:40发布

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

2条回答
再贱就再见
2楼-- · 2019-06-14 09:25

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

查看更多
Evening l夕情丶
3楼-- · 2019-06-14 09:27

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.

查看更多
登录 后发表回答