title: How to distinguish between Ethernet and WiFi IP Addresses using VB.NET
body: <p>I am trying to develop a generic VB.NET based application that will return me the Ethernet IP Address of the local machine. I have referred to several questions discussed here for getting the IP Address of the machine and found a few good suggestions.</p>
  
  <p>The problem I am facing is, when I run this application, it returns me the IP Address of both WiFi and Ethernet. When I run this application on somebody else's machine, I unable to tell which IP Address belongs to which interface. I am interested in Ethernet IP Address only.</p>
  
  <p>Any suggestions ??</p>
  
  <p>Here is the function that returns the list of IP Addresses.</p>
  
  <pre><code>Function getIP() As String
  
      Dim ips As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName)
  
      For Each ip In ips.AddressList
          If (ip.AddressFamily = System.Net.Sockets.AddressFamily.InterNetwork) Then
              MessageBox.Show(ip.ToString)
              Return ip.ToString
          End If
      Next
      Return Nothing
  
  End Function
  </code></pre>