note 93475 modified in function.socket-set-nonblock by cataphract

From: Date: Sat, 03 Sep 2011 18:36:03 +0000
Subject: note 93475 modified in function.socket-set-nonblock by cataphract
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-182931@lists.php.net to get a copy of this message
Beware, when using this function within a loop (i.e. a demon with a socket). The socket_accept(), for example, emits a warning each time there is no incoming connection available to be read. My php error log file got huge in a matter of seconds, eventually crashing the server. Of course, i used the @ before the function to take care of that problem. [EDITOR: One can (and should) use socket_select to detect a new connection on a socket (it's a "readable" event)] --was-- Beware, when using this function within a loop (i.e. a demon with a socket). The socket_accept(), for example, emits a warning each time there is no incoming connection available to be read. My php error log file got huge in a matter of seconds, eventually crashing the server. Of course, i used the @ before the function to take care of that problem. http://php.net/manual/en/function.socket-set-nonblock.php

« previous php.notes (#182931) next »