src/LineIO.php
public function read()
    {
        if ($this->socket === null) {
            return false;
        }

        if (feof($this->socket)) {
            return false;
        }

        $received = fread($this->socket, 4096);
        if ($received === false) {
            return false;
        }
        $this->incomingData .= $received;

        // Workaround for issue #8.
        $metadata = stream_get_meta_data($this->socket);
        if ($metadata['stream_type'] == 'tcp_socket/ssl' && !feof($this->socket)) {
            $blocking = (int) $metadata['blocked'];
            stream_set_blocking($this->socket, 0);
            $received = fread($this->socket, 4096);
            stream_set_blocking($this->socket, $blocking);

            if ($received !== false) {
                $this->incomingData .= $received;
            }
        }

        // Read all messages currently in the input buffer.
        while ($this->getLine()) {
            ; // Nothing more to do.
        }
        return true;
    }
public function read()
    {
        if ($this->socket === null) {
            return false;
        }

        if (feof($this->socket)) {
            return false;
        }

        $received = fread($this->socket, 4096);
        if ($received === false) {
            return false;
        }
        $this->incomingData .= $received;

        // Workaround for issue #8.
        $metadata = stream_get_meta_data($this->socket);
        if ($metadata['stream_type'] == 'tcp_socket/ssl' && !feof($this->socket)) {
            $blocking = (int) $metadata['blocked'];
            stream_set_blocking($this->socket, 0);
            $received = fread($this->socket, 4096);
            stream_set_blocking($this->socket, $blocking);

            if ($received !== false) {
                $this->incomingData .= $received;
            }
        }

        // Read all messages currently in the input buffer.
        while ($this->getLine()) {
            ; // Nothing more to do.
        }
        return true;
    }
public function read ( ) { if ( $ this -> socket === null ) { return false ; } if ( feof ( $ this -> socket ) ) { return false ; } $ received = fread ( $ this -> socket , 4096 ) ; if ( $ received === false ) { return false ; } $ this -> incomingData .= $ received ; // Workaround for issue #8. $ metadata = stream_get_meta_data ( $ this -> socket ) ; if ( $ metadata [ 'stream_type' ] == 'tcp_socket/ssl' && ! feof ( $ this -> socket ) ) { $ blocking = ( int ) $ metadata [ 'blocked' ] ; stream_set_blocking ( $ this -> socket , 0 ) ; $ received = fread ( $ this -> socket , 4096 ) ; stream_set_blocking ( $ this -> socket , $ blocking ) ; if ( $ received !== false ) { $ this -> incomingData .= $ received ; } } // Read all messages currently in the input buffer. while ( $ this -> getLine ( ) ) { ; // Nothing more to do. } return true ; }
Reads as many lines from the socket
as possible.

\retval bool
\b true if lines were successfully read,
\b false is returned whenever EOF is reached
or if this method has been called while
the socket was still uninitialized..

\note
This method blocks until lines have
been read of EOF is reached (whichever
comes first).
Reads as many lines from the socket as possible .