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

x
?
Solved

List all IP address in use on a LAN

Posted on 1999-07-12
3
Medium Priority
?
211 Views
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.
0
Comment
Question by:borgo
[X]
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
3 Comments
 
LVL 13

Expert Comment

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

Use http://www.rtfm.be/fpiette/pinguk.htm to do that.

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

Epsylon.
0
 
LVL 15

Accepted Solution

by:
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:

http://www.delphifreestuff.com/examples/wnetexmp.zip

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;
var
      wsdata      : TWSAData;
  he                  : PHostEnt;
  ss                  : pchar;
  ip                  : TInAddr;
begin
      WSAStartup(MakeWord(1, 1), wsdata);
  he := gethostbyname(pchar(name));
  if he<>nil then
  begin
        ip.S_addr := integer(pointer(he^. h_addr_list^)^);
     ss := inet_ntoa(ip);
     Result := string(ss);
  end;
  WSACleanup();
end;


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.


Yours,

Alex
Athena's Place: http://www.bhnet.com.br/~simonet
0
 

Author Comment

by:borgo
ID: 1387758
Many thanx to all of you who have helped me.
Regards.
Borgo.

0

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