如何通过使用vb.net编码发送mac ip地址作为输入来获取系统的IP地址?
使用我的班级:)
My.Computer.Name
至于IP地址快速谷歌搜索
Private Sub GetIPAddress() Dim strHostName As String Dim strIPAddress As String strHostName = System.Net.Dns.GetHostName() strIPAddress = System.Net.Dns.GetHostByName(strHostName).AddressList(0).ToString() MessageBox.Show("Host Name: " & strHostName & "; IP Address: " & strIPAddress) End Sub
Private Function GetIPv4Address() As String GetIPv4Address = String.Empty Dim strHostName As String = System.Net.Dns.GetHostName() Dim iphe As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(strHostName) For Each ipheal As System.Net.IPAddress In iphe.AddressList If ipheal.AddressFamily = System.Net.Sockets.AddressFamily.InterNetwork Then GetIPv4Address = ipheal.ToString() End If Next End Function