Alex Rivera | Logout

WCF VS. Sockets

Asked 2011-03-06T07:57:45.683
10

I would like to know which of WCF or .NET Sockets is the more efficient and the more recommended in a game developpment scenario.

Here are the different parts of the game :

-a client/server communication to play on the internet

-peer to peer on local network.

I would like to know which technology you would use on these parts (wcf on both, socket on both, wcf on one and socket on the other...) and why, if possible.

The game involved doesn't require a high communication frequency (3-4 per second is enough).

Edit
Report

1 Answer

7

The purpose of WCF is to save developers writing code for different transport protocols and it has large number of features so thats why it is slower than Sockets. Plus WCF is for service oriented applications. I dont think Games fall into this category.

But as you mention only 3-4 requests per second, WCF might be a better option as its very flexible and will save a lot of development time.

Some points:

The bindings that start with net* are meant to be used between .NET applications. (Both client and server WCF)
If any of the one is not WCF: You can only use the bindings that does not start with a net prefix. BasicHttpBinding, WSHttpBinding etc. These are much slower than the net* bindings as lot of overhead is there.

You can go ahead with NetPeerTcpBinding and play with it for a while. It also supports duplex communication.

Here are some useful links for P2P:

Peer-to-Peer Programming with WCF and .NET Framework 3.5
http://blogs.interknowlogy.com/2009/08/05/building-a-really-simple-wcf-p2p-application

answered 2011-03-06T09:10:37.110

Your Answer