[vb.net] IPAddresse ermitteln

Gepostet am: Mar 30, 2011 10:25:29 AM

ipAddress

Public Sub ipAddress(ByRef myArraylist As ArrayList, Optional ByVal ip4 As Boolean = True)         On Error Resume Next         Dim AddressList() As IPAddress = Dns.GetHostEntry(SystemInformation.ComputerName.ToString).AddressList         For Each Address In AddressList             If (Address.AddressFamily = System.Net.Sockets.AddressFamily.InterNetwork) And (ip4 = True) Then                 myArraylist.Add(Address.ToString)             ElseIf (Address.AddressFamily = System.Net.Sockets.AddressFamily.InterNetworkV6) And (ip4 = False) Then                 myArraylist.Add(Address)             End If         NextEnd Sub