UDP Client and Multiple NIC

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a small UDPClient listener app that displays UDP traffic from another
app running on several servers. It works great most of the time. When it is
installed on a box that has multiple NICs, I have a problem if one of the
NICs is down (i.e. a wireless connection that is not connected). If I
disable that NIC and restart the app, it works great. If I disable it once,
it doesn't matter if it is re-enabled as if it moves down the list and isn't
1st anymore. Is there a way to determine what NICs are valid/connected and
force the UDP client to bind? Here is the code:

Dim lIPAddress = IPAddress.Parse("224.168.100.2")
Dim lUdpClient = New UdpClient(1000, AddressFamily.InterNetwork)
lUdpClient.JoinMulticastGroup(lIPAddress)

Dim lIPEndPoint As New IPEndPoint(IPAddress.Any, 0)
While 1 = 1
Dim lByte As Byte() = lUdpClient.Receive(lIPEndPoint)
'Convert lByte to string
'...
Loop

Thanks in advance.
 
Back
Top