src/Network/Connection.php
private function connectionHasDataToRead($timeoutSec, $timeoutMicros)
    {
        $timeout = microtime(true) + $timeoutSec + ($timeoutMicros ? $timeoutMicros / 1000000 : 0);
        while (($hasData = $this->isDataOnStream()) === false) {
            if ($timeout < microtime(true)) {
                return false;
            }
            if ($this->waitCallback) {
                if (call_user_func($this->waitCallback) === false) {
                    return false;
                }
            }

            $slept = time_nanosleep(0, 2500000); // 2.5ms / 0.0025s
            if (\is_array($slept)) {
                return false;
            }
        }

        return $hasData === true;
    }
private function connectionHasDataToRead($timeoutSec, $timeoutMicros)
    {
        $timeout = microtime(true) + $timeoutSec + ($timeoutMicros ? $timeoutMicros / 1000000 : 0);
        while (($hasData = $this->isDataOnStream()) === false) {
            if ($timeout < microtime(true)) {
                return false;
            }
            if ($this->waitCallback) {
                if (call_user_func($this->waitCallback) === false) {
                    return false;
                }
            }

            $slept = time_nanosleep(0, 2500000); // 2.5ms / 0.0025s
            if (\is_array($slept)) {
                return false;
            }
        }

        return $hasData === true;
    }
private function connectionHasDataToRead ( $ timeoutSec , $ timeoutMicros ) { $ timeout = microtime ( true ) + $ timeoutSec + ( $ timeoutMicros ? $ timeoutMicros / 1000000 : 0 ) ; while ( ( $ hasData = $ this -> isDataOnStream ( ) ) === false ) { if ( $ timeout < microtime ( true ) ) { return false ; } if ( $ this -> waitCallback ) { if ( call_user_func ( $ this -> waitCallback ) === false ) { return false ; } } $ slept = time_nanosleep ( 0 , 2500000 ) ; // 2.5ms / 0.0025s if ( \ is_array ( $ slept ) ) { return false ; } } return $ hasData === true ; }
See if the connection has data left.

If both timeout-parameters are set to 0, it will return immediately.

@param int $timeoutSec Second-timeout part
@param int $timeoutMicros Microsecond-timeout part
@return bool
@throws ConnectionException
See if the connection has data left .