Since I get the feeling that the question (in the title) has not yet fully answered ...
Dim hostName = System.Net.Dns.GetHostName()
For Each hostAdr In System.Net.Dns.GetHostEntry(hostName).AddressList()
' If you just want to write every IP
Console.WriteLine("Name: " & hostName & " IP Address: " & hostAdr.ToString()
' If you want to look if the device is member of a specific network
If hostAdr.ToString().StartsWith("192.168.1.") Then DoSomething() : Exit For
' I think you get the idea ^^
' ...
Next
... obviously, this is not exactly what the OP asked for, but only from the name and google links, this should answer what people who are looking for are looking for it.
Btw GetHostByName()seems deprecated, GetHostEntry()as it works the same, without warning.
source
share