I found the solution to my question: socket_set_option() has the option SO_RCVTIMEO which set a timeout just for socket_recv()
for example:
socket_set_option($sock,SOL_SOCKET,SO_RCVTIMEO,array("sec"=>1,"usec"=>0));
This will set a timeout on my socket on the socket level for socket_recv() for 1second and 0 microseconds http://www.php.net/manual/en/function.socket-set-option.php
Thank you if you looked for a solution!