Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
134 views
in Technique[技术] by (71.8m points)

c# - WCF VS. Sockets

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If you want to maximize performance sockets is the way to go, WCF has both data and processing overhead. But... if performance is that critical to you, you should also consider assembler instead of c#.

WCF will handle 3-4 requests per second without a blink.

I would start with WCF, it will save you a lot of development time, no need to roll your own parser etc. You can concentrate on other parts on the game instead. If it actually turns our that WCF is too slow for your game you can throw WCF out and go for sockets instead.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...