VB.Net by API/System.Net/IPHostEntry

Материал из VB Эксперт
Перейти к: навигация, поиск

IPHostEntry.AddressList

  
Imports System.Net
Imports System.Net.Sockets

Public Class Tester
    Public Shared Sub Main

        Try
            Dim myIPHostEntry As IPHostEntry = Dns.Resolve("www.google.ru")
            Dim myIPAddresses() As IPAddress = myIPHostEntry.AddressList
            Dim myIPAddress As IPAddress
            Dim strIPAddressList As String
            For Each myIPAddress In myIPAddresses
                Console.WriteLine(myIPAddress.ToString)
            Next
        Catch ex As SocketException
            Console.WriteLine(ex.Message)
        End Try
    End Sub
End Class