Real-time communication with WCF
What's the best way to create a real-time communication with wcf? I.e. for games, I need a way that when a remote user press the left arrow ke开发者_StackOverflow社区y on his keyboard, an object in the server moves accordingly.
I think I should use WCF, is that the right option?
thanks!
I don't think it's a good idea to use WCF for games programming. The fastest way with WCF would probably be using NET TCP with one-way messages, but you still have quite a bit of overhead.
I'd suggest that you consider programming the sockets directly using UDP or look into a C# lib that does it for you, like lidgren: http://code.google.com/p/lidgren-network
Here are some nice beginner tutorials but they are in C/C++ but they show what you need to consider when you want to write networking code for games: http://www.gamedev.net/reference/list.asp?categoryid=30
Otherwise have a look at how networking is done with XNA. Here is a networking example: http://creators.xna.com/en-us/sample/networkp2p
It really depends on what kind of game you want to use it for. Requirements for a FPS are very different to the requirements for a strategy game.
精彩评论