vb.net ipvp4 get / ip가져오기
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

이 게시물을

댓글'1'
VNote (작성자)
  • 2022.02.16
  • 수정: 2022.02.16 17:18:30

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

이 댓글을

공유하기

SEARCH

MENU NAVIGATION