As a short heads-up for those unfamiliar:
- There is a PHP level buffer. Whenever more is actually read from the socket (default chunk size is 8192), than the user requests in his PHP code, the data is stored there.
- There is an OS level buffer. There all incoming network data lands. The event loop only knows of that one and checks that one for being non-empty.
The trivial reading function in PHP is fread($socket, $maxSize)
.