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
vnote
Public Function GetLocalIP() As String
Dim _IP As String = Nothing
Dim _IPHostEntry As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName())
For Each _IPAddress As System.Net.IPAddress In _IPHostEntry.AddressList
If _IPAddress.AddressFamily.ToString() = "InterNetwork" Then
_IP = _IPAddress.ToString()
End If
Next _IPAddress
Return _IP
End Function
이 댓글을