如何从 C# 应用程序远程调用另一个进程方法 [英] How to remote invoke another process method from C# application
问题描述
我有一个 C# 应用程序,我想从我的应用程序中调用一个函数名称,例如 SendChatMessage(string message, int userid).但是这个函数属于我计算机上另一个正在运行的基于客户端/服务器的应用程序.我找不到如何做到这一点的方法.
I have a C# app, i want to call a function name for example SendChatMessage(string message, int userid) from my app.But this function belongs another running client/server based application on my computer. I couldn't find the way how i can do this.
我尝试使用 Reflection 库来实现,但失败了.希望有人帮我解决这个问题.
I try to make this with Reflection library but failed. Hope someone help me about this.
感谢您的帮助.
推荐答案
欢迎来到Inter的世界-进程通信.有很多方法可以做到这一点,比如命名管道、RPC、共享内存等.
Welcome to the world of Inter-process communication. There are many methods to do this, like named pipes, RPC, shared memory, etc.
简而言之,您的程序在进程内运行.另一个程序正在另一个进程中运行.这就像你父亲试图向隔壁男孩问一些事情一样.这些进程可以相互通信并调用彼此的方法,或使用彼此的数据.但不是任意的或当然的.他们需要一些通用的通信标准.
In a nutshell, your program is running inside a process. The other program is running inside another process. It's like your father trying to asking something from the boy next-door. These processes can communicate with each other and invoke each other's methods, or use each other's data. But not arbitrarily or course. They need some common standard for communication.
看看这些问题:
这篇关于如何从 C# 应用程序远程调用另一个进程方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!