note 30402 deleted from ref.sockets by didou
| From: | didou@php.net | Date: | Tue, 16 Dec 2003 15:04:52 +0000 |
| Subject: | note 30402 deleted from ref.sockets by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-62060@lists.php.net to get a copy of this message | ||
Note Submitter: Benjamin Kuz
----
The talkback example shown on this page has an error, and may not function as intended on newer
versions of PHP.
the line that contains
if (FALSE === ($buf = socket_read ($msgsock, 2048))) {
needs to be
if (FALSE === ($buf = socket_read ($msgsock, 2048, PHP_NORMAL_READ))) {
This is due to changes in how PHP starts socket_read(), and may be confusing to people trying to use
the example.
The way it is, it appears that the socket_read() function is executed as quickly as possible
returning whatever is in it's buffer before an entire line can be sent. Adding PHP_NORMAL_READ
makes it so that the buffer isn't returned until either the buffer length is reached, or a
linefeed is sent.