使用vbscript进行进程间通信 [英] Inter Process Communication using vbscript
问题描述
我需要将数据从一个过程发送到另一个过程. 约束条件:
I need to send data form one process to another. Constraints :
发件人呼叫的过程非常昂贵. 它需要使用vbscipt完成. 对于发件人流程,此数据传输是一项额外的工作.此功能不会对其造成太大影响.在4-5分钟内,发送方进程中大约有1000个线程.
Sender process is very expensive call. It needs to be done using vbscipt. For Sender process,this data transferring is an additional work.It shouldn't get affected much by this feature. There are around 1000 threads in a sender process in 4-5 mins.
快速IPC很重要,如果可以异步完成,那就更好了. 我了解了有关命名管道的信息.是否可以使用vbscript打开命名管道.考虑到上述约束,还有其他可行的方法.
Faster IPC is important.If it can be done asynchronoulsy it will be better. I read about the named pipe.Is it possible to open a named pipe using vbscript .Also is there any other possible way considering the above constraints.
推荐答案
使用命名管道可能是本地VBScript的唯一选择.您可以通过使用其他某种语言编写COM对象来访问任何其他IPC方法.
Using a named pipe is probably your only option from native VBScript. You could access any of the other IPC methods by writing a COM object in some other language.
A named pipe can be written to just like a file so you can use the FileSystemObject to open and read/write from a named pipe. The format for opening a named pipe is to use the format \\\\.\pipe\PipeName
(Replace PipeName with the pipe's actual name).
因此要在VBScript中写入命名管道:
So to write to a named pipe in VBScript:
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("\\.\pipe\PipeName", True)
a.WriteLine("This is a test.")
a.Close
这篇关于使用vbscript进行进程间通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!