从服务器到客户端的通信。如何触发客户端? [英] Comunication from Server to Client. How trigger the Client?

查看:110
本文介绍了从服务器到客户端的通信。如何触发客户端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望这不是一个重复的问题。

我会告诉你问题。

我有一个应用程序WPF客户端和一个应用程序WPF服务器。



有时候,在这个通信的生命周期中,服务器应该向客户端发送数据(没有客户端什么都不问,我知道这很奇怪,我不知道如果有可能的话。



有可能在流中有一个触发客户端事件的机制

有数据由服务器发送??



感谢您的帮助,我希望我已经清楚地解释了这个问题!

Hi, i hope this is not a repeated question.
I'll show you the problem.
I've an application WPF Client, and an application WPF Server.

Sometimes, during the life of this comunication, Server should send data to Client(without client asked nothing, i know it's strange, and i don't know if it's possible).

Is possible to have a mechanism that triggers an event in the Client when in the Stream
there is the data sent by Server??

Thanks for help, i hope i have explained the problem clearly!

推荐答案

从形式上讲,纯客户端 - 服务器模型假定客户端永远不会被触发。一切都是由客户端主动执行的:客户端向服务器发送请求,服务器只接收请求并发送响应。



但是1)这个模型是如此惊人的限制我怀疑它的统治根植于行业中许多参与者的概念错误思考; 2)它看起来像你;尽管使用术语客户端和服务器实际上正在寻找一种方法来远离这种限制模型。我非常感谢你这样做。实际上,已知更多高级模型(例如发布者 - 订阅者,服务器推送),但遗憾的是,它们有点停滞,可能是由客户端 - 服务器的统治。



所以,你的问题提出了非常重要的问题,即使是一类问题:拉技术推技术

http://en.wikipedia.org/wiki/Pull_technology [ ^ ],

http://en.wikipedia.org/wiki/Push_technology [ ^ ]。



请参阅我以前的回答:网站帐户的应用程序'仪表板 [ ^ ]。



更多细节在很大程度上取决于您使用或想要使用的技术和标准。 (和WPF在这里完全不相关。或者,也许你想提到WFC?)

如果你的通信层几乎是自定义的(例如,纯粹基于TCP),那么客户端部分被触发了相当容易。请查看我过去的答案:

^](锚点已损坏,但链接应该有效;请参见下文),

来自同一端口的多个客户端号码 [ ^ ]。



(我们在帖子中遇到了CodeProject链接的问题。上面的第一个锚被破坏了。请使用:

http://www.codeproject.com/Answers/536542/ anplusamateurplusquestionplusinplussocketplusprogr#answer2

您必须自己将此URL复制并粘贴到浏览器。很抱歉给您带来不便。)



-SA
Formally speaking, pure client-server model assumes that the client is never triggered. Everything is executed by the initiative from the client side: client sends request to the server, and the server only takes the request and sends the response.

But 1) this model is so amazingly limiting that I suspect its domination is rooted in the conceptually mistaken thinking of many players in the industry; 2) it looks like you; despite of using of the term "client" and "server" in fact is looking for a way to go far away from this limiting model. And I really appreciate that you do. In fact, much more advanced models are known (such as publisher-subscriber, "server push"), but, regretfully, they were somewhat stalled, perhaps by the domination of the client-server.

So, your question raises very important issue, even the class of issues: pull technology vs. push technology:
http://en.wikipedia.org/wiki/Pull_technology[^],
http://en.wikipedia.org/wiki/Push_technology[^].

Please see my past answer: Application 'dashboard' for website accounts[^].

Further detail strongly depend on the technologies and standard you use or want to use. (And WPF it totally irrelevant here. Or, maybe you meant to mention WFC?)
If your communication layer is pretty much custom (for example, based purely on TCP), having the client part triggered would be fairly easy. Please see my past answers:
^] (anchor is broken, but the link should work; please see below),
Multple clients from same port Number[^].

(We are experiencing problem with CodeProject links in the posts. First anchor above is broken. Please use:
"http://www.codeproject.com/Answers/536542/anplusamateurplusquestionplusinplussocketplusprogr#answer2".
You have to copy and paste this URL to the browser yourself. Sorry for the inconvenience.)

—SA


这篇关于从服务器到客户端的通信。如何触发客户端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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