用C#创建虚拟串口
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13623284/
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
Creating virtual serial port with C#
提问by Liban
Possible Duplicate:
Faking an RS232 Serial Port
可能的重复:
伪造 RS232 串行端口
I have an application that reads data from serial port. To test the application i would like to create a virtual serial port that generates data and puts the the port at the same PC, so that the other app can access that data.
我有一个从串口读取数据的应用程序。为了测试应用程序,我想创建一个生成数据的虚拟串行端口并将端口放在同一台 PC 上,以便其他应用程序可以访问该数据。
Any idea how?
知道怎么做吗?
Thanks
谢谢
采纳答案by Honza Brestan
I have used com0comtool for this. It has no direct API, but you can write an application (or a method) which starts a new com0com process to set up / modify your virtual ports "on the fly" with commandline parameters.
我为此使用了com0com工具。它没有直接的 API,但您可以编写一个应用程序(或方法)来启动一个新的 com0com 进程,以使用命令行参数“即时”设置/修改您的虚拟端口。

