Resend - Re: [VPM] network discovery

Darren Duncan darren at DarrenDuncan.net
Wed Jun 9 14:17:11 CDT 2004


At 12:05 AM -0700 6/9/04, Jeremy Aiyadurai wrote:
>hi all,
>how do i discover all hosts (ip's and hostnames) on a lan, using perl.
>my reason is that i am working on a client/server app. my ip's 
>change from time to time on my network, depending on when and which 
>machines are shutdown/restarted, and it is hard for me to find any 
>pattern, if there is such a thing.
>thanks in advance for any help.
>Jeremy A.

You could try pinging all the possible addresses every now and then; 
those which reply exist.  Since you're on a LAN, there are usually 
only 254 possible IP addresses (at least with a normal LAN), which 
would take a few seconds in total to test.  The address ranges are, 
as I recall, 192.168.0.1 thru 192.168.1.254.  (The .0 and .255 are 
never used by machines; they are reserved for broadcast or similar 
things; for that matter, .1 may be used by the router itself, leaving 
253 others to test.) -- Darren Duncan



More information about the Victoria-pm mailing list