0

我想通过互联网将某些参数远程传递给桌面应用程序。我不希望我的应用程序反复联系服务器,因为许多这样的应用程序可以很容易地关闭服务器。有没有办法从服务器启动连接?我如何识别这些应用程序,因为它们中的许多将在全球某处的许多计算机上运行。我不知道从哪里开始 - 我正在尝试在服务器端的 C# 和 ASP.NET/PHP 中执行此操作。请给一些建议。

4

2 回答 2

1

有没有办法从服务器启动连接?

不。不是没有客户端首先与服务器联系,通知它 IP 地址,要使用的端口等......服务器需要为每个客户端保留哪些,希望它们不会更改(或在何时更新他们确实改变了)。

客户端的长轮询是您正在做的事情的正确解决方案,即使您不想使用它。

于 2012-07-08T11:30:03.773 回答
0

There are many different ways you could approach this, just thinking out of the box, both your app and the server could utilize a different mechanism for transferring the settings. I'm not recommending any of these methods, please don't shoot me down, they are all just ideas.

As an example, your server could connect out using FTP and output the updated settings to an FTP server on each PC. You could install something like Filezilla on each machine which runs your app. You'd obviously need to configure port forwarding on the router to allow the server FTP access.

You could use email. Setting up an email account where your server can login to send out the settings. Your app could possibly login to the same email account possibly even a single Gmail account to retrieve the settings.

Another idea would be to use a file sharing service like Dropbox, Google Drive or similar and where the settings could be shared. Obviously this would involve learning any API and I'm not sure if there are any restrictions on this approach.

The last idea and probably my preferred approach would be to host a web service and database on a remote server, both your server and the applications would connect to the same service to transfer the settings. This approach is obviously firewall/router friendly as all the clients connect out to the web service to collect the required data.

Hope this helps?

于 2012-07-08T20:23:25.980 回答