命名管道取消/重建 [英] Named Pipe De/Re-Construction

查看:87
本文介绍了命名管道取消/重建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经构建了一个VB.NET应用程序,该应用程序的两个实例通过一个单独的命名管道(仅)相互交谈.

I have built a VB.NET application, two instances of which talk (only) to each other via a single named pipe.

一个实例被配置为命名管道服务器,另一个实例被配置为客户端.

One instance is configured as named pipe Server, and the other as Client.

很好,但是一旦断开管道(例如通过停止客户端或服务器),我将无法重新建立管道.

Works fine, except that once I break the pipe (such as by stopping either the Client or the Server), I am unable to re-establish it.

我已尽一切努力摧毁"了我.管道和相关对象,但保持所有管道实例都忙"状态.尝试重新创建它时,所以我丢失了一些东西.

I have tried everything I can find to "destroy" the pipe and associated objects, but keep getting "All pipe instances are busy" when trying to re-create it, so I am missing something.

是否有一种方法可以销毁管道,以便应用程序可以像重新启动管道一样重新创建管道?

Is there a way to destroy the pipe so that the application can re-create it as if it was just starting up?

在此先感谢您的帮助!

推荐答案

您好,RomT,

Hi RomT,

>>是否有一种销毁管道的方法,以便应用程序可以像刚启动一样重新创建它?

>>Is there a way to destroy the pipe so that the application can re-create it as if it was just starting up?

简短的回答是否".在.NET Framework中,我们通过使用NamedPipeServerStream和NamedPipeClientStream类来实现命名管道.众所周知,这两个类都是从Stream类继承的.关闭后我们将无法重新使用流

The short answer is no.  In the .NET Framework, we implement named pipes by using the NamedPipeServerStream and NamedPipeClientStream classes. As we know, both the two classes inherited from Stream class. We can't re-use the stream after we close it.

最好的问候,
王丽

Best Regards,
Li Wang


这篇关于命名管道取消/重建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆