title: Socket_set_nonblock error
body: <p>Ok so i have a class that uses <code>while(true)</code> and it connects using a socket. Now my problem is that when i use socket_set_nonblock it doesn't connect it dies with "Could not connect.". When i put it after sending a packet, it goes from the start and re does everything.</p>
  
  <p>Here is my connect function:</p>
  
  <pre><code>function connect($ip, $port) {
          if($this-&gt;soc!=null) socket_close($this-&gt;soc);
          $this-&gt;soc = socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
          if(!$this-&gt;soc) die(socket_strerror(socket_last_error($this-&gt;soc)));
          if(!socket_connect($this-&gt;soc,$ip,$port)) die("Could not connect."); 
  
      }
  </code></pre>
  
  <p>Heres the function when attempting to use socket_set_nonblock</p>
  
  <pre><code>function connect($ip, $port) {
          if($this-&gt;soc!=null) socket_close($this-&gt;soc);
          $this-&gt;soc = socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
          socket_set_nonblock($this-&gt;soc);
          if(!$this-&gt;soc) die(socket_strerror(socket_last_error($this-&gt;soc)));
          if(!socket_connect($this-&gt;soc,$ip,$port)) die("Could not connect."); 
  
      }
  </code></pre>