WCF VS.套接字 [英] WCF VS. Sockets

查看:267
本文介绍了WCF VS.套接字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道哪些WCF或.NET套接字是更有效和更推荐在游戏developpment场景。

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客户端/服务器通信到互联网上播放

-a client/server communication to play on the internet

-peer对等本地网络上。

-peer to peer on local network.

我想知道哪些技术,您将这些部件(WCF两个,插座两个,WCF在一个插座上的其他...),为什么使用,如果可能的话。

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.

涉及的游戏不需要很高的通信频率(3-4每秒就够了)。

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

谢谢

风筝

推荐答案

周转基金的目的是为了节省开发人员编写code代表不同的传输协议,它有大量的功能,所以这就是为什么它是比插座慢。加上WCF是面向服务的应用程序。我不认为游戏都属于这一类。

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.

不过,你提到只有每秒3-4请求,WCF可能是一个更好的选择,因为它非常灵活,并节省大量的开发时间。

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.

的几点:

这开始用网*的绑定,目的是要.NET应用程序之间使用。 (客户端和服务器WCF)
如果有任何一个不WCF:你只能使用不以净preFIX绑定。 basicHttpBinding的,WsHttpBinding的等这比*绑定网慢得多的大量开销是存在的。

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.

您可以使用 NetPeerTcpBinding 继续和它玩一会儿。它也支持全双工通信。

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

下面是P2P一些有用的链接:

Here are some useful links for P2P:

的对等网络编程使用WCF和.NET Framework 3.5
http://blogs.interknowlogy.com/2009/08/05/building-a-really-simple-wcf-p2p-application

这篇关于WCF VS.套接字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆