Tag: virtual pc

COM端口与Virtual PC通信

我正在测试使用COM-Port的应用程序。 该应用程序在Virtual PC中运行。 我已经设置了Virtual PC设置,以便为COM1-Port使用命名管道\。\ pipe \ mypipe。 现在我正在尝试使用C#与此命名管道进行通信。 using (var pipe = new NamedPipeServerStream(@”\\.\pipe\mypipe”)) { pipe.WaitForConnection(); using (var reader = new StreamReader(pipe)) { // Do some communication here } } 程序正在WaitForConnection()等待,虽然Virtual PC正在运行,我正在尝试与COM-Port通信。 我也尝试了以下内容,因为我不确定是否必须在程序中创建命名管道,或者命名管道是由Virtual PC创建的。 var p = new NamedPipeClientStream(@”pipe\mypipe”); p.Connect(); 我在这做错了什么?