#35077 [Fbk->Opn]: stream_set_timeout() does not work with stream_socket_recvfrom()

From: Date: Thu, 03 Nov 2005 16:03:29 +0000
Subject: #35077 [Fbk->Opn]: stream_set_timeout() does not work with stream_socket_recvfrom()
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969370771@lists.php.net to get a copy of this message
ID: 35077 Updated by: wez@php.net Reported By: pn2865 at yahoo dot com -Status: Feedback +Status: Open -Bug Type: Sockets related +Bug Type: Documentation problem Operating System: * PHP Version: 5.0.5 New Comment: It's supposed to work this way; use stream_select() to implement your own timeout when you're doing "advanced" things like this. Changing to a documentation problem. Previous Comments: ------------------------------------------------------------------------ [2005-11-03 15:48:31] sniper@php.net Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip ------------------------------------------------------------------------ [2005-11-03 03:12:36] pn2865 at yahoo dot com Description: ------------ Sample program tries to get data via UDP and never completes if none received. Use any IP address and port that does (or does not) exist and you get the same result if that IP does not send a UDP packet to the system this snippet is run on. Reproduce code: --------------- $server_recv = stream_socket_server("udp://192.168.1.100:9999", $errno, $errstr, STREAM_SERVER_BIND); if (!$server_recv) exit ("ERROR: stream_socket_server failed"); set_time_limit(2); // Will not interrupt stream_socket_recvfrom stream_set_timeout($server_recv,3,0); $packet=stream_socket_recvfrom($server_recv, 1000); $info = stream_get_meta_data($server_recv); if ($info['timed_out']) echo 'Connection timed out!'; else echo "Got back '$packet'"; Expected result: ---------------- Should timeout at 3 seconds. Actual result: -------------- Never comes back from stream_socket_recvfrom call. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=35077&edit=1

« previous php.doc (#969370771) next »