title: C# UdpClient.receive() not receiving responses to broadcast request
body: <p>I am trying to send data from my laptop to UDP server which communicates on port 30718. Data sending is correct, but when I want to receive response, program stucks on UdpClient.receive() method. i tried to sniff network with wireshark and it seem that response is delivered correctly, but c# will not receive it.
  Here is my code:</p>
  
  <pre><code>private void button1_Click(object sender, EventArgs e)
      {
          byte[] data = new byte[4];
          data[0] = 0x00;
          data[1] = 0x01;
          data[2] = 0x00;
          data[3] = 0xF6;
  
          byte[] rcvPacket = new Byte[1024];
          UdpClient client = new UdpClient();
          IPAddress address = IPAddress.Parse("255.255.255.255");
          client.EnableBroadcast = true;
          client.Connect(address, 30718);
          IPEndPoint remoteIPEndPoint = new IPEndPoint(IPAddress.Any, 0);
  
  
          client.Send(data, 4);
          rcvPacket = client.Receive(ref remoteIPEndPoint);
  
          string rcvData = Encoding.ASCII.GetString(rcvPacket);
          client.Close();  //close connection
      }
  </code></pre>
  
  <p>And here is output from wireshark (second picture is response to broadcast request):
  <a href="https://i.stack.imgur.com/P6bdQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/P6bdQ.jpg" alt="wireshark1"></a></p>
  
  <p><a href="https://i.stack.imgur.com/8TI9r.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8TI9r.jpg" alt="wireshark2"></a></p>
  
  <p>Does anybody have solution for fixing this problem?
  Thank you.</p>