title: UDP broadcast fails in desktop client
body: <p>I am trying to send broadcast message in network using UDP client in C#, but i don't see message received by any listener client in network, how can i troubleshoot?</p>
  
  <p>I am trying to communicate with unknown IP (micro controller device)/PC, hence i am using broadcast proprietary message on UDP broadcast. i have need to get remote device static IP hence i am using broadcast.</p>
  
  <p>Sender code</p>
  
  <pre><code>
  IPAddress broadcast = null;
  
  Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
  
  s.EnableBroadcast = true;
  
  // proprietary message for identification 
  byte[] sendbuf = {0x5C, 0x45, 0x6D, 0x62, 0x65, 0x64,
              0x4C, 0x6F, 0x67, 0x69, 0x6B, 0x5, 0x6C, 0x73, 0x74, 0x5, 0x4, 0x5};
  
  broadcast = IPAddress.Parse("255.255.255.255");
  
  IPEndPoint ep = new IPEndPoint(broadcast, 1110);
  
  s.SendTo(sendbuf, ep); // send message
  </code></pre>
  
  <p>I used the code from Microsoft site and modified for the IP to 255.255.255.255, however when i use IP 192.168.2.255 (router IP 192.168.2.1) the device (micro controller based device) responds, i also checked with UDP listener on another PC in network, but i dont see listener receiving(another PC) message not also on wireshark when ip is set as 255.255.255.255 for broadcast. 
  To experiment i turned off router and connected PC(sender) and PC(listener) to just switch but there  was no message of received on listener.</p>
  
  <p>when i connect device (micro controller device) directly to PC, it works on both 255.255.255.255 and 192.168.2.255. i dont understand how to troubleshoot when device is in network and why broadcast doesnt work in network.</p>
  
  <p>need help to resolve this ? in case any point is unclear please notify</p>
  
  <p><strong>EDIT 1:</strong> i changed to code from micro controller to output sendto(255.255.255.255)
  Now when i use directed broadcast (192.168.2.255) i can see both outgoing message from application and as well as incoming message to application (from MCU (255.255.255.255)) on wire shark</p>
  
  <p>but when i use IP 255.255.255.255 on application for sending message i don't see any packet on wire shark.</p>
  
  <p>Edit2: However i believe it C# or windows that is blocking UDP broadcast,i tried the application on Win7 as well as win10.</p>