title: C# UDP listener un-blocking? or prevent revceiving from being stuck
body: <p>I've been searching for previous problems like mine here but it seems I can't find the answer I need.</p>
  
  <p>My goal is to prevent my UDP listener from not hanging. I have a UDP listener who waits for messages but if there is nothing to receive it just hangs there.</p>
  
  <p>I have read other threads and they say that I need to set the <strong>Blocking to false</strong> but I can't find how to set it. Sorry I'm just new to C# and to socket programming.</p>
  
  <p>Here's the part of my listener: </p>
  
  <pre><code>while (true)
  {
      try
      {
          byte[] data = listener.Receive(ref groupEP);
  
          IPEndPoint newuser = new IPEndPoint(groupEP.Address, groupEP.Port);
          string sData =  (System.Text.Encoding.ASCII.GetString(data));
  
      }
      catch (Exception e)
      {
      }
  }
  </code></pre>
  
  <p>My problem is it just freezes on the following line:</p>
  
  <pre><code>byte[] data = listener.Receive(ref groupEP);
  </code></pre>