PhpAmqpLib/Wire/AMQPReader.php
protected function wait()
    {
        $timeout = $this->getTimeout();
        if (null === $timeout) {
            // timeout=null just poll state and return instantly
            $sec = 0;
            $usec = 0;
        } elseif ($timeout > 0) {
            list($sec, $usec) = MiscHelper::splitSecondsMicroseconds($this->getTimeout());
        } else {
            // wait indefinitely for data if timeout=0
            $sec = null;
            $usec = 0;
        }

        $result = $this->io->select($sec, $usec);

        if ($result === false) {
            throw new AMQPIOWaitException('A network error occurred while awaiting for incoming data');
        }

        if ($result === 0) {
            if ($timeout > 0) {
                throw new AMQPTimeoutException(sprintf(
                    'The connection timed out after %s sec while awaiting incoming data',
                    $timeout
                ));
            } else {
                throw new AMQPNoDataException('No data is ready to read');
            }
        }
    }
protected function wait()
    {
        $timeout = $this->getTimeout();
        if (null === $timeout) {
            // timeout=null just poll state and return instantly
            $sec = 0;
            $usec = 0;
        } elseif ($timeout > 0) {
            list($sec, $usec) = MiscHelper::splitSecondsMicroseconds($this->getTimeout());
        } else {
            // wait indefinitely for data if timeout=0
            $sec = null;
            $usec = 0;
        }

        $result = $this->io->select($sec, $usec);

        if ($result === false) {
            throw new AMQPIOWaitException('A network error occurred while awaiting for incoming data');
        }

        if ($result === 0) {
            if ($timeout > 0) {
                throw new AMQPTimeoutException(sprintf(
                    'The connection timed out after %s sec while awaiting incoming data',
                    $timeout
                ));
            } else {
                throw new AMQPNoDataException('No data is ready to read');
            }
        }
    }
protected function wait ( ) { $ timeout = $ this -> getTimeout ( ) ; if ( null === $ timeout ) { // timeout=null just poll state and return instantly $ sec = 0 ; $ usec = 0 ; } elseif ( $ timeout > 0 ) { list ( $ sec , $ usec ) = MiscHelper :: splitSecondsMicroseconds ( $ this -> getTimeout ( ) ) ; } else { // wait indefinitely for data if timeout=0 $ sec = null ; $ usec = 0 ; } $ result = $ this -> io -> select ( $ sec , $ usec ) ; if ( $ result === false ) { throw new AMQPIOWaitException ( 'A network error occurred while awaiting for incoming data' ) ; } if ( $ result === 0 ) { if ( $ timeout > 0 ) { throw new AMQPTimeoutException ( sprintf ( 'The connection timed out after %s sec while awaiting incoming data' , $ timeout ) ) ; } else { throw new AMQPNoDataException ( 'No data is ready to read' ) ; } } }
Waits until some data is retrieved from the socket.

AMQPTimeoutException can be raised if the timeout is set

@throws \PhpAmqpLib\Exception\AMQPIOWaitException on network errors
@throws \PhpAmqpLib\Exception\AMQPTimeoutException when timeout is set and no data received
@throws \PhpAmqpLib\Exception\AMQPNoDataException when no data is ready to read from IO
Waits until some data is retrieved from the socket .