C# 中的 NamedPipe 超时

发布于 2024-07-09 21:03:01 字数 106 浏览 6 评论 0原文

我有几个应用程序相互通信,并且我使用 NamedPipe。 但如果其他应用程序不可用,则 NamedPipe 将永远等待连接。 它也不支持超时。

这样做的正确方法是什么?

I have a couple of apps talking to each other, and I use a NamedPipe. But if the other app isn't available then the NamedPipe waits for ever to connect. It also doesn't support timeouts.

What's the right way to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅听莫相离 2024-07-16 21:03:01

您是否使用 NamedPipeClientStream 类? 如果是这样,则 Connect 过载,需要超时值。 这将允许您指定放弃之前等待的时间。

Are you using the NamedPipeClientStream class? If so there is an overload of Connect which takes a timeout value. That will allow you to specify how long you wait before giving up.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文