Vista 上锁定的串行端口

发布于 2024-07-10 05:43:18 字数 394 浏览 9 评论 0原文

我正在开发一个与串行端口通信的应用程序,在我的开发机器上,我运行的是 Vista,并且该串行端口是蓝牙连接。 有时,串行端口会陷入我的应用程序无法再连接到它的状态。 在 .net 中,我收到一个 IOException,其中显示一条消息“未找到元素”。

我尝试重新启动应用程序,连接其他应用程序(像 HyperTerm 这样的通信客户端),但没有任何帮助。 我找不到任何更具体的错误消息,并且计算机的事件日志中没有记录任何内容。 设备管理器告诉我该端口“工作正常”。

有没有办法找出哪个进程和/或.dll 拥有串行端口,和/或强制关闭端口?

如果有什么区别的话,我的应用程序是用 C# 编写的,但从结构上来说,用“using”语句打开和关闭端口并不方便。

谢谢, 安迪

I'm working on an App that talks to a serial port, and on my development machine, I'm running Vista, and that serial port is a Bluetooth connection. Occasionally, the serial port gets caught in a state where my App can no longer connect to it. In .net I get an IOException with a message reading "Element not found."

I've tried restarting the App, connecting with other Apps (a communications client like HyperTerm) but nothing helps. I can't find any more specific error message, and nothing is logged to the machine's event logs. The device manager tells me the port is "working properly."

Is there any way to find out which process and or .dll has possession of a serial port, and/or force a port closed?

If it makes any difference, my App is in C#, but structurally, it's not convenient to open and close the port with a "using" statement.

Thanks,
Andy

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

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

发布评论

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

评论(1

梦冥 2024-07-17 05:43:18

据我所知,您无法关闭您没有权限的串行端口。 我对蓝牙串行端口的经验是,它们最终可能会在连接时映射到不同的 COM 端口号,并且有时在断开连接时会留下虚假的 COM 端口。 例如,我当前没有连接蓝牙设备,但如果进入设备管理器,我会看到总共有 11 个 COM 端口列为蓝牙串行端口。每个端口的属性将设备显示为工作正常并且可用,尽管偶尔会出现故障,但我通常可以打开这些端口。 我的解决方法是通过属性/高级/COM 端口号强制连接设备的 COM 端口号。 我不确定问题是否与驱动程序相关(在本例中为 IVT corp),或者与 Windows 管理蓝牙串行端口的方式有关。

抱歉我无法提供更多帮助。

To the best of my knowledge you can't close a serial port that you do not have the handle to. My experience of Bluetooth serial ports is that they can end up getting mapped to different COM port numbers at connection time, and can sometimes leave bogus COM ports when disconnected. For example, I currently have no bluetooth devices connected, but if I go into device manager, I see a total of eleven COM ports listed as Bluetooth serial port The properties on each of these ports show the device as working and available, and I can usually open these ports though I get occasional failures. My work around for this is to force COM port numbers for connected deviced, through properties / advanced / COM port number. I'm not sure if the problem is driver related (IVT corp in this case) or a problem with the way Windows manages blutooth serial ports.

Sorry I couldn't be of any more help.

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