GetPortNames和Isopen之间的区别

编程入门 行业动态 更新时间:2024-10-26 21:29:17
本文介绍了GetPortNames和Isopen之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我使用了GetPortNames属性。它显示了其他应用程序打开的所有端口。我使用了Isopen属性,它总是告诉False。实际上端口是由调制解调器打开的。它应该给予真实的权利。但它没有给予。任何人都知道...解释

I used GetPortNames property.It shows all the ports which are opened by other applications.I used Isopen property, It tells False always.Actually the port is opened by modem. it should give "true" right. But its not giving. Anybody Knows... explain

推荐答案

msdn.microsoft/en-us/library/system.io.ports.serialport.isopen(v = vs.110)的.aspx [ ^ ] IsOpen文档说明,IsOpen属性跟踪端口是否打开以供调用者使用,不是机器上的任何应用程序是否打开了端口。 我想你需要找到另一种说法。 多年前,我知道使用UDP端口,我能判断它们是否正在使用的唯一方法是尝试打开一个,如果我有一个例外它意味着另一个应用程序打开它。也许串行端口有类似的东西。 msdn.microsoft/en-us/library/system.io.ports.serialport.isopen(v=vs.110).aspx[^] The IsOpen documentation states, "The IsOpen property tracks whether the port is open for use by the caller, not whether the port is open by any application on the machine." I guess you'll need to find another way to tell. I know with UDP ports, years ago, the only way I could tell if they were in use was to try and open one and if I got an exception it meant another app had it open. Perhaps serial ports have something similar.

更多推荐

GetPortNames和Isopen之间的区别

本文发布于:2023-10-06 19:42:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1467634.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:区别   GetPortNames   Isopen

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!