双向communcating客户端/服务器架构? [英] Two way communcating server/client architecture?

查看:109
本文介绍了双向communcating客户端/服务器架构?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出哪些客户机/服务器技术(即其.NET Framework的一部分)来使用我们的新的应用程序。我们将使用.NET 3.5 SP1在写应用程序在C#。

I'm trying to figure out which client/server technology (i.e. which part of the .NET Framework) to use for our new application. We will be writing the app in C# using .NET 3.5 SP1.

这是要由将要运行的服务器,并在几台机器多个客户应用s $ P $垫出中央服务。客户端应用程序是将要从服务器接收通知的trayapp应用,同时还将发送一些信息回服务器。因此该通信将是双向的,并且它需要快。服务器将需要知道的通知发送到的客户端。

It is going to consist of a central Service that will be running as a "server", and several client applications spread out on several machines. The client application is a trayapp application that is going to receive notifications from the server, and will also send some information back to the server. The communication will therefore be two-way, and it needs to be fast. The server will need to know which client to send the notifications to.

我一直在想,我可以使用套接字。我也遇到了和的TcpListener类TcpClient的。另一种方法是做什么的WCF,但我不知道怎么用它做快速的双向沟通​​。

I've been thinking that I could use Sockets. I've also come across the TcpListener and TcpClient classes. Another alternative is to do something with WCF, but I'm not sure how to do fast two-way communication with it.

可能有人给我一些建议吗?

Could someone give me some tips?

推荐答案

不知道你有多少数据计划交换,这是很难做出precise建议。我同时使用WCF和TCP套接字我的UI和我的Windows服务之间交换数据。下面是我所做的考虑。

Without knowing how much data you're planning to exchange, it's difficult to make a precise recommendation. I use both WCF and TCP sockets to exchange data between my UI and my Windows service. Here are the considerations I made.

我使用WCF为我所说的非周期性数据交换。例如,当事件在我的Windows服务时,我使用WCF通信的事件的用户界面。专门为这款基于事件的机制,我会极力推荐Juval洛伊的发布 - 订阅框架,这是可以在这里 >。我也使用WCF从UI到Windows服务通信配置更改。 WCF是这样的,我的数据交换的完美解决方案。

I use WCF for what I refer to as aperiodic data exchange. For example, when an event occurs in my Windows service, I communicate the event to the UI using WCF. Specifically for this event-based mechanism, I would highly recommend Juval Lowy's Publish-Subscribe Framework, which is available for free here. I also use WCF to communicate configuration changes from the UI to the Windows service. WCF is a perfect solution for this kind of data exchange for me.

当用户告诉我的Windows服务来执行一些动作,很多数据是从Windows服务对UI发送。对于这一点,我使用的TCP套接字。我知道WCF具有流媒体功能,并使用我强烈认为。我只是没有时间去熟悉它之前,我不得不做出决定,所以我什么,我知道了。

When the user tells my Windows service to perform some action, a lot of data is sent from the Windows service to the UI. For this, I use TCP sockets. I know WCF has a streaming capability, and I strongly considered using it. I just did not have time to get comfortable with it before I had to make a decision, so I went with what I knew.

虽然我希望我用WCF全线为对称性,即非周期和数据流,这种混合方法也使我受益匪浅。

While I wish I was using WCF across the board for symmetry, i.e., for aperiodic and streaming data, this hybrid approach has served me well.

希望这有助于。

这篇关于双向communcating客户端/服务器架构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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