UDPClient problem (broadcast and multiple network adapters.)

  • Thread starter Thread starter Sagaert Johan
  • Start date Start date
S

Sagaert Johan

Hi

My PC has static IP 192.168.1.3
when i broadcast a packet then when using MS network monitor 3.2 ; it
originates from 192.168.1.3

When i have my smartphone connected (active sync ) then the udp packet
seems to originate from 169.254.2.2

It seems my UdpClient gets bound to the wrong network adapter.

How can i find the IP of my (real) network adapter ?

Johan

My init code is :
IPEndPoint ep=new IPEndPoint(IPAddress.Any,7311);

UdpClient udp_sock = new UdpClient(ep);

udp_sock.EnableBroadcast = true;
 
To solve it , i enumerated the interfaces and discarded the ones with and
169.* address.
 
Back
Top