Ahmed Mohamed
Ahmed Mohamed

Reputation: 413

Getting list of local IP addresses with winapi

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 ?

Upvotes: 0

Views: 1412

Answers (1)

Deanna
Deanna

Reputation: 24303

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.

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.

Upvotes: 2

Related Questions