There could possibly be other ways and information when DNS host name is not available, but these could also mean more device specific interfacing. One global option is to get the
MAC address, the first 3 bytes of these 6 is something called OUI (Organizationally Unique Identifier) and there exist a public list where you can at least find out which manufacturer produced the NIC, the other 3 bytes probably only each manufacturer known what means. Here is an example I have tested and which worked, you need this declaration:
Quote:
|
Private Declare Function SendARP Lib "iphlpapi.dll" (ByVal DestIP As Integer, ByVal SrcIP As Integer, ByRef pMacAddr As Long, ByRef PhyAddrLen As Integer) As Integer
|
The
OUI list can be downloaded from IEEE.org.
Sample code to get MAC and OUI:
Code:
Dim ip As Integer = CInt(Net.IPAddress.Parse("192.123.45.67").Address)
Dim mem As Long
Dim ret As Integer = SendARP(ip, 0, mem, 6)
Dim ab() As Byte = BitConverter.GetBytes(mem)
Dim OUI As String = BitConverter.ToString(ab, 0, 3)
Nevermind the Address obsolete warning, also Vista runs IP4 compatibility translation.
With the OUI string you can search the text file or create yourself a smaller lookup table from it. When successful it is for example more useful to know this manufacturer name "CANON INC." than only the IP.