note 94879 added to function.stream-get-line
| From: | pk at ritm dot ru | Date: | Mon, 30 Nov 2009 17:30:36 +0000 |
| Subject: | note 94879 added to function.stream-get-line | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-163425@lists.php.net to get a copy of this message | ||
fgets is faster but stream_get_line is more useful in a tcp server scripts.
when fgets reads some bytes from socket, where EOF is reached, it returns bool(false) same as
stream_get_line
BUT if remote client drops connection, and server script will try to read some data with function
fgets, function will return bool(false), and stream_get_line will return string(0) ""
so you can detect remote client disconnection with stream_get_line, and cannot with fgets
----
Server IP: 78.41.111.4
Probable Submitter: 92.100.113.104
----
Manual Page -- http://www.php.net/manual/en/function.stream-get-line.php
Edit -- https://master.php.net/note/edit/94879
Del: integrated -- https://master.php.net/note/delete/94879/integrated
Del: useless -- https://master.php.net/note/delete/94879/useless
Del: bad code -- https://master.php.net/note/delete/94879/bad+code
Del: spam -- https://master.php.net/note/delete/94879/spam
Del: non-english -- https://master.php.net/note/delete/94879/non-english
Del: in docs -- https://master.php.net/note/delete/94879/in+docs
Del: other reasons-- https://master.php.net/note/delete/94879
Reject -- https://master.php.net/note/reject/94879
Search -- https://master.php.net/manage/user-notes.php