从Windows应用程序向服务应用程序发送大量数据

发布于 2025-01-05 16:09:45 字数 745 浏览 0 评论 0原文

我正在构建一个具有一些远程桌面功能的系统。客户端被认为是共享其桌面的每台计算机,服务器被认为是带有数据库的中央服务器,该数据库接收所有多个桌面的图像。在客户端,我想构建两个项目:一个Windows服务应用程序和一个VCL表单应用程序。每个客户端应用程序可能会在计算机上的不同用户帐户下运行,因此可能会同时运行多个客户端应用程序,并且它们都将其图像发送到此客户端服务,该客户端服务将它们中继到中央服务器。

该服务将负责连接到服务器、发送图像以及接收鼠标/键盘事件。在后台运行的应用程序将以某种方式连接到该服务并将屏幕截图传输到该服务中。目标是一项服务正在运行,同时多个“客户端”能够连接到该服务并发送其桌面图像。该服务将连接到“中央服务器”,该服务器从不同的“客户端”接收所有这些不同的屏幕截图。然后,图像将被保存并记录或重定向到可能正在查看该“客户端”的任何“仪表板”。

问题是我应该使用什么方法将客户端应用程序连接到客户端服务来发送图像?它们将在同一台计算机上运行。我需要发送简单命令数据包以及传输图像块的能力。我本来打算使用 Indy 组件(TIdTCPServer 等),但我确信必须有一种更简单、更干净的方法来实现它。我也在项目的其他地方使用 Indy 组件。

这是我想要的整个系统的图表 - 我只是担心最右边和最左边的部分 - 应用程序连接到同一台计算机内的服务。正如您所看到的,由于有很多层,我需要确保我使用的任何方法都足够强大,可以容纳大量图像数据的流式传输。

系统结构

I'm building a system with some remote desktop capabilities. The client is considered every computer which is sharing its desktop, the server is considered a central server with a database which receives the images of all the multiple desktops. On the client side, I would like to build two projects: A windows service application and a VCL forms application. Each client app would presumably be running under a different user account on the computer, so there might be multiple client apps running at once, and they all send their image into this client service, which relays them to the central server.

The service will be responsible for connecting to the server, sending the image, and receiving mouse/keyboard events. The application, which is running in the background, will connect to this service some how and transmit the screenshots into the service. The goal is that one service is running while multiple "clients" are able to connect to it and send their desktop image. This service will be connected to the "central server" which receives all these different screenshots from different "clients". The images will then be either saved and logged or re-directed to any "dashboard" which might be viewing that "client".

The question is through what method should I use to connect the client applications to the client service to send images? They will be running on the same computer. I will need both the abilities to send simple command packets as well as stream a chunk of an image. I was about to use the Indy components (TIdTCPServer etc.) but I'm sure there must be an easier and cleaner way to do it. I'm using the Indy components elsewhere in the projects too.

Here's a diagram of the overall system I'm aiming for - I'm just worried about the parts on the far right and far left - where the apps connect to the service within the same computer. As you can see, since there are many layers, I need to make sure whatever method(s) I use are powerful enough to accommodate for streaming massive amounts of image data.

System Structure

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

只是一片海 2025-01-12 16:09:46

我已经在多种不同的配置中这样做过几次。让我轻松完成的关键是使用 RemObjects SDK,它负责通信部分。通过控制其状态的线程,我可以连接到可靠的服务器或服务,并且可以传输从状态字节到传输许多兆字节数据的任何内容(建议您对大数据使用小块,以便您可以对错误和流程进行更细粒度的控制)。我现在拥有一组高可靠性模板,我可以很容易地部署它们来制作新的变体,并且可以使用新的函数调用进行更新,而无需太多麻烦(我做的第一件事是在客户端和服务器之间协商版本,以便他们知道什么)他们可以支持)。因为这一切都在较高的级别上运行,所以我的代码只是进行“函数调用”,而不必担心线路上的格式是什么。同样,我可以从二进制格式切换到标准 SOAP 或其他格式,而无需更改核心逻辑。最后,连接可以是本地连接,连接到同一台计算机(我将其用于与后台服务通信的最终用户应用程序),也可以连接到 LAN 或互联网上的计算机。全部都在同一个代码中。

I've done this a few times now, in a number of different configurations. The key to making it easy for me was using the RemObjects SDK which took care of the communications part. With a thread that controls its state, I can have a connection to a server or service that is reliable, and can transfer anything from a status byte through to transferring many megabytes of data (it is recommended that you use small chunks for large data so that you have more fine grained control over errors and flow). I now have a set of high reliability templates that I can deploy to make a new variation quite easily, and it can be updated with new function calls without much hassle (first thing I do is negotiate versions between the client and server so they know what they can support). Because it all works at a high level, my code is just making "function calls" and never worrying about what the format on the wire is. Likewise I can switch from their binary format to standard SOAP or other without changing the core logic. Finally, the connections can be local, to the same machine (I use this for end user apps talking to a background service) or to a machine on the LAN or internet. All in the same code.

夜司空 2025-01-12 16:09:45

进程间通信,可以使用Pipe/Mailslots/Socket,我也认为发送流文件时共享内存可能是最有效的方式

Communicates among processes, you can use Pipe/Mailslots/Socket, I also think while sending a stream file Shared Memory maybe the most efficient way

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文