title: How to make UdpClient non blocking
body: <p>I am new in Socket programming and C#. I am trying to create an application in which I am using <code>UdpClient</code>.</p>
  
  <p>But even there is data on socket but sometime the <code>Receive function</code> not receiving any data and goes to blocking state.
  Just to prevent this from blocking I use a counter.
  The receive function is on thread.</p>
  
  <p>And in <code>main function</code> I have create a counter </p>
  
  <pre><code>int count = 0;
  bool ret = IsDataReceived();
  while(!ret &amp;&amp; count &lt; 30)
  {
    ret = IsDataReceived();
    count++;
  }
  
  if(count&gt;= 30)
  {
  thread.abort();
  
  udpclient.close();
  }
  else
  {
  Console.WriteLine("Data Received");
  }
  </code></pre>
  
  <p>I am currenlty doing like this but I want to know that how can I make a <code>UdpClient</code> non blocking.</p>
  
  <p>Thanks in Advance.</p>