note 82474 added to function.fread

From: Date: Sat, 12 Apr 2008 13:22:17 +0000
Subject: note 82474 added to function.fread
Groups: php.notes 
Request: Send a blank email to php-notes+get-138233@lists.php.net to get a copy of this message
If you read from a socket connection or any other stream that may delay when responsing but you want to set a timeout you can use stream_set_timeout(): <?php $f = fsockopen("127.0.0.1", 123); if ($f) { fwrite($f, "hello"); stream_set_timeout($f, 5); //5 seconds read timeout if (!fread($f, 5)) echo "Error while reading"; else echo "Read ok"; fclose($f); } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 79.116.169.129 ---- Manual Page -- http://www.php.net/manual/en/function.fread.php Edit -- https://master.php.net/note/edit/82474 Del: integrated -- https://master.php.net/note/delete/82474/integrated Del: useless -- https://master.php.net/note/delete/82474/useless Del: bad code -- https://master.php.net/note/delete/82474/bad+code Del: spam -- https://master.php.net/note/delete/82474/spam Del: non-english -- https://master.php.net/note/delete/82474/non-english Del: in docs -- https://master.php.net/note/delete/82474/in+docs Del: other reasons-- https://master.php.net/note/delete/82474 Reject -- https://master.php.net/note/reject/82474 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#138233) next »