Question about socket_select

From: Date: Tue, 13 Dec 2011 23:11:32 +0000
Subject: Question about socket_select
Groups: php.general 
Request: Send a blank email to php-general+get-315999@lists.php.net to get a copy of this message
Hello, It appears to me that something is strange with the socket_select function. From what I understand the value of the fourth parameter, tv_sec, should block the execution of the script for that number of seconds. I tried this code : <?php error_reporting(E_ERROR); $serverSocket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); $result = socket_bind($serverSocket, "127.0.0.1", "20668"); $start = time(); while(true) { $reads = array($serverSocket); $writes = null; $except = null; $changes = socket_select($reads, $writes, $except, 5); $now = time(); echo $now - $start; echo "\n"; } and when I run it with php -q server3.php the ouput shows something like 0 0 0 0 0 1 1 1 1 1 2 2 2 2 etc so the script doesn't pause on socket_select until it returns. Cam somebody explain me what's happening ? Thanks

« previous php.general (#315999) next »