使用winapi获取本地IP地址列表 [英] Getting list of local IP addresses with winapi

查看:798
本文介绍了使用winapi获取本地IP地址列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取使用WINAPI连接到局域网的所有本地IP地址的列表?我通过netapi32.dll搜索并没有成功。任何想法?

How to get a list of all local IP addresses connected to the LAN using WINAPI? I searched through netapi32.dll and haven't been successful. Any thoughts ?

推荐答案

没有保证的方式获取连接到您的本地段的所有设备的地址。机器可能被防火墙和删除重新请求,或者在检查机器未配置为访问的不同子网中具有IP地址。

There is no guaranteed way to get the addresses of all devices connected to your local segment. Machines may be firewalled and dropping requets, or have IP addresses in different subnets that the checking machine isn;t configured to access.

您可以在子网上找到所有设备通过向本地子网上的每个IP地址发送ping请求(使用IP Helper库中的 ICMPSendEcho())并检查响应来响应ping。

You can find all devices on the subnet that respond to a ping by sending a ping request (using ICMPSendEcho() in the IP Helper library) to every IP address on the local subnet and check for responses.

这篇关于使用winapi获取本地IP地址列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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