LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

get dhcp & ip & name

Hi every body,
I am deveolpping a *.vi that communicates with a machine on tcp/ip protocol.
The firts part of my *.vi would be to read the IP address of the PC on whitch it is running (non dependant of the windows language) and the mask, give them, see if the pc is in DHCP (dynamic ip adress) : How do i do that ?
After that i change the pc ip adress : i know how to do it.
All of that because at the end of the *.vi, i would like the *.vi to give the pc its ip adress or dhcp back.
Thanks in advance...
RS
0 Kudos
Message 1 of 5
(3,231 Views)
As long as you stick to Windows, using the system exec function with the command "ipconfig /all" will return the info in the standard output.
0 Kudos
Message 2 of 5
(3,231 Views)
Yes i have tried this method.
The problem is that i am now working on a french windows 2000 and i have this kind of answer :C:\>ipconfig /all

Configuration IP de Windows 2000
(...)
Ethernet carte Connexion au réseau local :
(...)
DHCP activé . . . . . . . . . . . : Oui

and the answer is in french.
My application will be used on italian windows, and so the text won't be the same. And further more, if on another windows the positions of the lines is not the same, my program won't work.
I was thinking of a *.vi using functions in "C" language but i don't know C
0 Kudos
Message 3 of 5
(3,231 Views)


Bonjour!

The following works even if you have multiple network cards, and (hopefully) on any language-OS: you can get the IP addresses from the registry. This is a two step process:

1. Enumerate the network card keys by reading the subkeys at this location:

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards

For each of this subkey, read its 'ServiceName' value.


2. Append the 'ServiceName' values to the following key and read the 'IPAddress' value:

HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces

If you're using DHCP, you'll instead read values for 'DhcpIPAddress.'

Hope this helps.

Khalid


0 Kudos
Message 4 of 5
(3,231 Views)
I have already tried, but when i look at the service name I have this kind of name :
"{xxB6019-x-x-xx1A96F0DE}"
The name i am looking for is the name given by the function ipconfig, like :
"Connexion au réseau local" in french or maybe "local network" in english. Or maybe a way to establish a link between the two names listed above.
0 Kudos
Message 5 of 5
(3,231 Views)