----- Original Message -----
From: "Kevin Parker" <[EMAIL PROTECTED]>
Sent: Monday, August 26, 2002 9:45 PM
Subject: [DUG]: IP addresses


> Hi  all
>
> I have an app with an indy client and servers.  The client polls server
> app's on every mc in a network.  My problem is how do I get a list of all
> the currently routable IP addresses in the network?  I need an answer for
> both static and dynamic IP address allocation.

If all of the IP addresses are on the same subnet then you can send a UDP
packet to the broadcast address.  Anything on that subnet that is listening
for the packet should reply, giving you a map of active clients.  You may be
able to broadcast a ping-type packet to find all machines, or you may have
to write support for your own broadcast ping into the client.

The problem with this method is that you generally (if the network's router
is configured correctly) have to do it locally.  This means that if your
client apps have to be able to do it remotely then you'll have to have a
local machine do it for them and maintain a list they can query.

Another method, if you just need a list of servers, is to have each server
contact a list holder on a static IP address when they start and
periodically while they're running.  If it's internal then you can make the
period smaller - say 20 seconds for example.  If a server misses more than
one checkin then it can be removed from the list.  This way you can tell not
only if the computer is up, but also if the server is running or not.

There are other options, some using lower level networking stuff that I'm
not familiar with, but I guess it depends on what you're trying to achieve.
The central server option is useful in that it reduces the number of packets
that have to cross your internet gateway/router/whatever, but really it's
most useful for internet clients.

--
Corey Murtagh
The Electric Monk
"Quidquid latine dictum sit, altum viditur!"

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to