Получить имя компьютера по его IP-адресу
Imports System.Net
Imports System.Net.Sockets
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ipAddr As IPAddress
Dim remoteHostEntry As IPHostEntry
Try
ipAddr = IPAddress.Parse(TextBox1.Text)
remoteHostEntry = Dns.GetHostByAddress(ipAddr)
TextBox2.Text = (remoteHostEntry.HostName)
Catch ex As SocketException
TextBox2.Text = (ex.StackTrace.ToString)
End Try
End Sub
End Class |
|