Created
January 1, 2015 10:23
-
-
Save ooltcloud/3b5e539241b938b64b2c to your computer and use it in GitHub Desktop.
ホスト名文字列から Net.IPAddress を取得する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Shared Function GetIPv4FirstAddress(address As String) As Net.IPAddress | |
Dim entries = Net.Dns.GetHostAddresses(address) | |
For Each ip In entries | |
If ip.AddressFamily = Net.Sockets.AddressFamily.InterNetwork Then | |
Return ip | |
End If | |
Next | |
Return Nothing | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment