通过服务器触发自动更新程序 [英] automatic updater triggered via server

查看:99
本文介绍了通过服务器触发自动更新程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我需要一个服务器和客户端应用程序,该服务器应用程序会触发客户端应用程序下载xml文件进行更新.

hello i need a server and client application which server application triggers client application to download xml file to make updates.

推荐答案

在纯客户端-服务器范例中不能触发客户做某事.客户端纯粹是主动的,服务器纯粹是被动的,它仅响应客户端发送的请求.

要触发客户端,您需要...停止调用双方客户端"和服务器" :-).

严重地,您将需要控制权反转( http://en.wikipedia.org/wiki/Inversion_of_control [^ ]). 发布者-订阅者是您所需要的概念.客户端部分应连接到服务并订阅一些事件.服务器应更新其客户端集合(例如,在最简单的情况下,由其远程套接字表示).服务流程中发生某些事件时,它应该向集合中的所有客户端发送通知.

至少,对发布者-订户的服务需要在服务部分上有两个线程:一个线程侦听新连接,一个线程使用某些应用程序级协议通过网络流执行数据交换.

可以(通常应该)将此模式与常规"客户端-服务器交互结合.

请查看我对此类应用程序体系结构的了解:来自同一端口的多个客户端编号 [ ^ ].可以有不同的设计来实现这种行为.我试图描述几乎最简单的情况.

我怕要说,这样的工作并不适合初学者.

—SA
In a pure client-server paradigm there is no a way to trigger a client to do something. A client is purely active, a server is purely passive, it only responds to request sent by a client.

To trigger a client you need to… stop calling the sides "client" and "server" :-).

Seriously, you will need inversion of control (http://en.wikipedia.org/wiki/Inversion_of_control[^]). The concept close to what you need is publisher-subscriber. A client part should connect to the service and subscribe to some class of events. A server should update its collection of clients (for example, represented by their remote sockets, in the simplest case). When some events happens in the service process, it should send notification to all the clients in the collection.

As a minimum, servicing of the publisher-subscriber requires two threads on the service part: one to listen to new connections, one to perform data exchange via network stream using some application-level protocol.

This schema can be (and usually should) be combined with "regular" client-server interaction.

Please see my skeleton of the architecture of such application: Multple clients from same port Number[^]. There can be different designs implementing such behavior. I tried to describe nearly the simplest possible case.

I fear to say, such work in not quite for beginners.

—SA


一个真正简单的解决方案是使用Msmq-这是我前一段时间写的一篇文章:Microsoft消息队列–一个简单的多线程客户端和服务器 [
A really easy solution is to use Msmq - here is an article I wrote a while ago: Microsoft Message Queuing – A Simple Multithreaded Client and Server[^]

Just create a queue on the client side too, and pass the name to the server. Add an OnReceiveCompleted handler to the client similar to what I do for the server - actually the client logic will be fairly identical to the server logic.

This approach is nice and simple - give it an hour or two, and you are done.

Best regards
Espen Harlinn


好的,听起来很简单.你开始了吗?如果您不是程序员,则需要付钱给程序员才能做到这一点,而不是要求我们为您这样做.
OK, well, that sounds trivial. Have you started yet ? If you''re not a programmer, you need to pay a programmer to do this, not ask us to do it for you.


这篇关于通过服务器触发自动更新程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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