使用wmi win32类检查可用端口? [英] Check on avaiable port using wmi win32 class?

查看:326
本文介绍了使用wmi win32类检查可用端口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用inno设置制作安装文件.它需要提取本地ip地址(我可以通过查询Win32_NetworkAdapterConfiguration来完成此操作),并检查是否打开了特定端口以运行该软件(我目前正在寻找答案).

I am using inno setup to make an installation file. It required to pull local ip address (which I able to do by querying Win32_NetworkAdapterConfiguration) and check if a specific port is open for the software to run on (which I am currently looking for an answer).

我意识到WMI Win32类包含许多有用的信息.所以我想知道如果可以的话,我应该使用哪个Win32类来检查此端口?

I realize that WMI Win32 classes contain so many useful information. So I wonder which Win32 class should I use to check on this port given that if it is possible to do that?

谢谢

推荐答案

AFAIK唯一可检查给定端口是否打开的WMI类是 ConnectToPort 方法,但是此类仅在Windows XP中存在.因此,如果您想在其他Windows版本中使用该选项,则可以尝试导入(或编写自己的应用程序并从inno调用)Winsock之类的 How to check if a TCP port is available with Delphi?

AFAIK the only WMI class to check if a given port is open is the NetDiagnostics WMI class and the ConnectToPort method, but this class only is present in Windows XP. So if you want an option which works in another Windows versions you can try to import (or write your own application and invoke from inno) something like the Winsock connect function, like is show on this question How to check if a TCP port is available with Delphi?

这篇关于使用wmi win32类检查可用端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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