.net IPC通道连接通知

发布于 2024-10-27 11:55:26 字数 289 浏览 6 评论 0原文

我使用 RegisterWellKnownClientType 和 RegisterWellKnownServerType 在 .NET2 中创建了一个 IPC 通道。

先创建服务器还是先创建客户端并不重要 - 一旦它们都运行,它们就会相互连接。

问题是,我发现知道何时建立连接的唯一方法是尝试调用函数,如果没有则捕获异常。

是否有一个事件或我可以连接的东西可以告诉我通道何时连接? 目前在客户端中,我使用计时器来轮询连接。

(顺便说一句,我对使用 WCF 不感兴趣,因为我们陷入了 .NET2)

I've created an IPC channel in .NET2 using RegisterWellKnownClientType and RegisterWellKnownServerType.

It doesnt matter whether the server or client is created first - they'll connect to each other once they're both running.

The problem is that the only way I've found to know when the connection is made, is by trying to call a function, and catching the exception if they're not.

Is there an event or something I can hook up to that will tell me when the channel is connected?
Currently in the client, I use a timer to poll for the connection.

(BTW, i'm not interested in using WCF as we're stuck in .NET2)

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文