Hi.
Do you want to know your own IP or form an other computer?
For this case i use this code:
Imports system.net
Public Shared Function GetIP(Optional ByVal computer As String = "") As ArrayList
Dim computername As String
Dim host As IPHostEntry
Dim hostadresses() As IPAddress
Dim i As Integer = 0
Dim IPs As ArrayList = New ArrayList
If computer = String.Empty Then
computername = Dns.GetHostName()
Else
computername = computer
End If
host = Dns.GetHostEntry(computername)
hostadresses = host.AddressList()
For i = 0 To hostadresses.GetLength(0) - 1
IPs.Add(hostadresses(i).ToString())
Next
Return IPs
End Function
If you leave the Optional Byval computer empty, you will get your own IP-Adress.
If the DNS-Name of an other computer is known -> you can get the IP.
The Function returns the Ip-Adresses in an ArrayList.
I hope I can help with this code-sample :cool:
Regards,
Z