title: How to read socket data with socket_recvfrom?
body: <p>I need to get information from UDP socket, but the fact that i do not know how many answers will receive so i decided to wait for a few seconds. The main problem is that <code>socket_recvfrom</code> blocks and all the code stuck... Is there some way to wait for a few second and stop the socket?</p>
  
  <p>My code:</p>
  
  <pre><code>$end_time = time() + 2;
  
  while ($end_time &gt; time()) {
      socket_recvfrom($socket, $buffer, 2500, 0, $from, $port);
      var_dump($buffer);
  }
  </code></pre>