C# IPC 建议和比较
我在 .net 工作了几年,这是我第一次涉足 IPC。我知道进行 IPC(命名管道、远程处理、剪贴板管理、Win32API 消息传递)的各种可能性,但我不知道什么“适合我”。我计划使用以下设置:
站点对象:这就是需要 ipc 的原因。它将是一个代表远程计算机上文件集合的单个对象(可能是本地的,也可能是真正远程的)。
服务器:server.exe 进程将监视上述文件系统,并更新站点对象。然后,该进程将保持所有连接到服务器的客户端更新,定期提供站点对象的新副本(无论是从客户端还是从客户端)强制更新,或服务器自动更新)。
客户:需要定期更新“网站”。它还希望具有修改 Site 对象的能力(或者至少向服务器发送消息要求其进行特定修改。TL
;DR 版本:服务器上的 Singleton 实例(将主动修改单例),具有多个客户端监视单例。客户端可以更改(或请求服务器更改)单例。
注释:所有 .net,没有混合平台我已经研究过远程处理,但它似乎与我想要的应用程序无关。拥有(或者我没有完全理解它),
我不确定这些是否更适合社区维基,请随意使用,
谢谢。
I've been working in .net for a few years, and this is my first foray into IPC. I know of the various possibilities for doing IPC (Named Pipes, Remoting, Clipboard Managment, Win32API messaging), but I don't know whats "right for me". I plan on using the following setup:
Site Object: This is the reason the ipc is needed. It will be a single object representing a collection of files on a remote machine (may be local, might be truly remote).
Server: The server.exe process will monitor the file system mentioned above, and update the Site Object This process will then keep any\all clients connected to the server updated, giving out new copies of the Site object at regular intervals (Either from client forced updates, or server automatic updates).
Client: Needs to be regularly updated about the "Site". It also wants to have the ability to modify the Site object (or at least send messages to the server asking it to make specific modifications.
TL;DR version: Singleton instance on the server (which will actively modify the singleton), with multiple clients monitoring the singleton. The client can change (or request the server to change) the singleton.
Notes: All .net, no mixing of platforms. I've looked into Remoting, but it seemed out of context for the application I'd like to to have (or I didn't understand it fully).
I'm not sure if these is better fit for a community wiki or not, feel free to jerk it around.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
.NET Remoting 只是 .NET 2.0 的功能 - 一组技术和库,可简化常见进程间通信方式(命名管道、网络套接字、HTTP post/get 查询)的使用。
在 .NET 3.0 中它是 WCF。
所以歌词,对于你来说:在安全 LAN 上的机器之间使用 TCP 套接字,在 Internet 上使用 HTTP(Soap、WebMethods 或只是 HTTP),在一台机器上使用 IPC 来通信进程(客户端和服务器)
您选择的平台(.NET 2.0 Remoting 或 .NET 3.0 WCF) - 由您决定。
PS:我仍然使用.NET 2.0 Remoting框架。
.NET Remoting is just the feature of .NET 2.0 - a set of techniques and libraries that simplifies the usage of common inter-process commutication ways (Named pipes, network sockets, HTTP post/get queries)
In .NET 3.0 it is WCF.
So the lyrics, as for you: use TCP sockets between machines on the secured LAN, use HTTP (Soap, WebMethods, or just HTTP) on the Internet and IPC on one machine to communicate processes (client and server)
The platform you choose (.NET 2.0 Remoting or .NET 3.0 WCF) - it's up to you.
P.S.: I use .NET 2.0 Remoting framework still.