Windows 上的进程间通信
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1008957/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Interprocess communication on windows
提问by Byron Whitlock
I have a TCL script running on windows. I need to communicate to a old vc++ 6 app running in a different process. I need to have 2 way communication. In Linux I would use dbus, but what IPC strategy should I use for windows?
我有一个在 Windows 上运行的 TCL 脚本。我需要与在不同进程中运行的旧 vc++ 6 应用程序进行通信。我需要进行 2 路通信。在 Linux 中我会使用 dbus,但是我应该为 Windows 使用什么 IPC 策略?
采纳答案by Colin Macleod
Tcl on windows has dde support built-in (see docs for the dde command) which could help if the other application supports this. Another option is the TWAPI (Tcl Windows API) extension, which has facilities for sending keyboard and mouse input to another application, see http://twapi.magicsplat.com/input.html.
Windows 上的 Tcl 具有内置的 dde 支持(请参阅 dde 命令的文档),如果其他应用程序支持此功能,这可能会有所帮助。另一种选择是 TWAPI(Tcl Windows API)扩展,它具有将键盘和鼠标输入发送到另一个应用程序的功能,请参阅http://twapi.magicsplat.com/input.html。
回答by rlbond
Boost.interprocesshas various ways such as shared-memory and message passing for C++. You could always start there and see what is compatible with your script.
Boost.interprocess有多种方式,例如 C++ 的共享内存和消息传递。你总是可以从那里开始,看看什么与你的脚本兼容。
回答by aJ.
How about named pipes ?
如何命名管道?
回答by Nikolai Fetissov
Plain old sockets work great in TCL on Windows (and Linux, and everywhere TCP/IP is implemented :)
普通的旧套接字在 Windows(和 Linux,以及所有实现 TCP/IP 的地方)的 TCL 中工作得很好:)
回答by Corbin March
A list of options from MSDN : http://msdn.microsoft.com/en-us/library/aa365574(VS.85).aspx
MSDN 中的选项列表:http: //msdn.microsoft.com/en-us/library/aa365574(VS.85).aspx
If you want something more 'enterprisy', there's also Windows Message Queue.
如果您想要更“企业化”的东西,还有Windows Message Queue。
回答by Hymanson
From the Tcl perspective the simplest way, if your VC6 app allows it, would be to get TCL to start the VC app and then use stdin and stdout to communicate. If that's not possible the the Tcl socket command allows you to establish a TCP socket connection with another process.
从 Tcl 的角度来看,如果您的 VC6 应用程序允许,最简单的方法是让 TCL 启动 VC 应用程序,然后使用 stdin 和 stdout 进行通信。如果这不可能,Tcl 套接字命令允许您与另一个进程建立 TCP 套接字连接。
See herefor details of the first and herefor some info on sockets.