Solved

Detecting DHCP

Posted on 2000-05-17
2
152 Views
Last Modified: 2010-03-05
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
Comment
Question by:paulca
2 Comments
 
LVL 16

Accepted Solution

by:
maneshr earned 50 total points
ID: 2817445
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
 
LVL 10

Expert Comment

by:makerp
ID: 2817631
just see if 'ipconfig /all' displayed an ip address next to the DHCP server entry .

0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

777 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