• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 166
  • Last Modified:

Detecting DHCP

What is the best way to detect DHCP running on a computer using perl and then actually getting that dynamic IP address?  Is there a Win32 module or function call that I can use?
0
paulca
Asked:
paulca
1 Solution
 
maneshrCommented:
i think, on NT boxes you can use the ipconfig /all to find and get the IP address.

all that you need to do is use basic PERL parse capabilities to parse thru the output and extract the relevant info.

as an sg. i have this small program which will give you the IP address of the machine on which its running.

## call the external command & get its output
$output=`ipconfig /all`;

## Remove the enter char at the end of the output
chomp($output);

## Parse for and extract the ip address
$output=~ /\s+IP Address.*:\s+(\d+.*)/;
$ip_address=$1;

## print the ip address!!
print $ip_address,"\n";
0
 
makerpCommented:
just see if 'ipconfig /all' displayed an ip address next to the DHCP server entry .

0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now