Board index » delphi » Number of NICs installed and IP Address...

Number of NICs installed and IP Address...

Hi,

I need to know if the computer my program will be running on has one or
two NIC(s) and the IP address of each card detected. Anymore cards are
ignored.

Using "GetHostByName", I collect 8 bytes from the
resulting "PhostEnt.h_addr_list" array. This gives me two possible IP
addresses.

Then using "GetHostByAddr" on each address I check for a valid name. If
the result is nil then I "think" the address is invalid.

Is this a good way to do it? Does anyone know of a better way to collect
the number for NICs installed and the IP address's? Maybe a faster way?

TIA,

Mark

 

Re:Number of NICs installed and IP Address...


For Windows 2000/Windows 98 check out the platform SDK:

GetAdaptersInfo(...)

http://msdn.microsoft.com

Or see your latest MSDN subscription.

--

J. Scott Sanbar
MCSE/CNE/MCP+Internet
Advanced Micro Consulting
 -- Maker of Tracemap Network Security Software

Quote
<za...@pdq.net> wrote in message

news:MPG.11bb1fce3ff9e1ad989685@news.pdq.net...
Quote

> Hi,

> I need to know if the computer my program will be running on has one or
> two NIC(s) and the IP address of each card detected. Anymore cards are
> ignored.

> Using "GetHostByName", I collect 8 bytes from the
> resulting "PhostEnt.h_addr_list" array. This gives me two possible IP
> addresses.

> Then using "GetHostByAddr" on each address I check for a valid name. If
> the result is nil then I "think" the address is invalid.

> Is this a good way to do it? Does anyone know of a better way to collect
> the number for NICs installed and the IP address's? Maybe a faster way?

> TIA,

> Mark

Other Threads