English 中文(简体)
IPCWindows COM港
原标题:Windows COM port for IPC

视窗COM港是否可以用同一个人计算机的两种方案进行程序间通信? 我们的最终目标是起草一份方案,在COM港口进行通信,以控制硬件。 由于硬件无法使用,我们希望在虚拟COM港的节目中复制硬件,并做出反应。

一个三维推器将是一个方案,等待从COM港读到矿石,并以书面形式对COM港做出反应。 从这些讯息的价值观开始,就难以编码。

因此,我在C/C++上用<代码>ReadFile 、WriteFile通过窗户读写的功能写成两个节目。 这种做法不会因为接触冲突而发挥作用。 因此, 我不禁要问,我们对支持者的态度是否是错误的。

我对基于Windows的方案拟订工作是新的,尽管我在其他领域有方案拟订经验。 任何帮助都将受到高度赞赏。

<>Update:

解决办法:

  • Installed Virtual Serial Port Driver 7.1 by Eltima Software (trial version)
  • Added a pair of virtual ports (e.g. COM1 and COM2)
  • The controller program communicates through COM1
  • The emulator program communicates through COM2
  • Eltima software takes care of transferring the data between the two ports
最佳回答

你们可以打开一个具有共享参数的文件,使两个进程都能阅读/做成。 但这不是一个很好的解决办法,因为阅读/书写的序列港在阅读和书写档案方面有一些差异。

相反,我建议获得一个虚拟的COM港口司机(如 com0com.sourceforge.net,或从这里挑选另一个人:wikipedia.org/wiki/COM_port_redirector)。 总而言之,创建两个COM港口,将其几乎连接起来。 这样,你就能够确保你的方案也将在真正的COM港开展工作。

如果这种解决办法不能被接受,则使用管道而不是档案

问题回答

暂无回答




相关问题
Why running a service as Local System is bad on windows?

I am trying to find out the difference between difference service account types. I tumbled upon this question. The answer was because it has powerful access to local resources, and Network Service ...

Programmatically detect Windows cluster configuration?

Does anyone know how to programatically detect that a Windows server is part of a cluster? Further, is it possible to detect that the server is the active or passive node? [Edit] And detect it from ...

get file icon for Outlook appointment (.msg)

I ve read Get File Icon used by Shell and the other similar posts - and already use SHFileInfo to get the associated icon for any given extension, and that works great. However, Outlook uses ".msg" ...

Identifying idle state on a windows machine

I know about the GetLastInputInfo method but that would only give me the duration since last user input - keyboard or mouse. If a user input was last received 10 minutes ago, that wouldn t mean the ...

Terminating a thread gracefully not using TerminateThread()

My application creates a thread and that runs in the background all the time. I can only terminate the thread manually, not from within the thread callback function. At the moment I am using ...

热门标签