Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


List all IP address in use on a LAN

Posted on 1999-07-12
Medium Priority
Last Modified: 2010-04-06
Hi Expert
How Can I list all the IP addres which are in use over my LAN ? I use some dynamic IPs (DHCP server) and some static IPs. I'd like to code something like "network neighbours" but listing Ip address near the PC name.
Thank you.
Question by:borgo
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 13

Expert Comment

ID: 1387756
The easiest way I think is to ping a range IP addresses.

Use to do that.

I don't know who to communicate with the DHCP server.

LVL 15

Accepted Solution

simonet earned 400 total points
ID: 1387757
Here's how I do it (and it works):

First of all, download  the sample for a Network enumerator application. You can find the sample application here:

The sample app above will read all the machines (servers + wksta) on a LAN, plus all the shared/available resources on each machine. You can, if you want, make small adjustments on the application so it returns only machines. PLease let me know if you have troubles doing that.

Now, the second step is to get the IP for each machine found. For that you can use the function below, passing the name of the machine as the parameter:

uses WinSock;

function GetAddressByName(name : string) : string;
      wsdata      : TWSAData;
  he                  : PHostEnt;
  ss                  : pchar;
  ip                  : TInAddr;
      WSAStartup(MakeWord(1, 1), wsdata);
  he := gethostbyname(pchar(name));
  if he<>nil then
        ip.S_addr := integer(pointer(he^. h_addr_list^)^);
     ss := inet_ntoa(ip);
     Result := string(ss);

That's all it takes.
Note: The function above may be a little slow depending on the network. On Win95 and WinNT networks it's a little slow.


Athena's Place:

Author Comment

ID: 1387758
Many thanx to all of you who have helped me.


Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question