src/PTel.php
public function waitFor($str, $maxtimeout = 10) {
        $timestart = time();
        $buff = '';
        while (true) {
            $buff .= $this->recvChr();
            $timerun = time() - $timestart;

            if (preg_match("/$str/", $buff, $matches)) {
                return true;
            }

            if ($timerun >= $maxtimeout) {
                throw new TelnetException("Could not find occurance [ $str ] within timeout");
            }
        }
        return false;
    }
public function waitFor($str, $maxtimeout = 10) {
        $timestart = time();
        $buff = '';
        while (true) {
            $buff .= $this->recvChr();
            $timerun = time() - $timestart;

            if (preg_match("/$str/", $buff, $matches)) {
                return true;
            }

            if ($timerun >= $maxtimeout) {
                throw new TelnetException("Could not find occurance [ $str ] within timeout");
            }
        }
        return false;
    }
public function waitFor ( $ str , $ maxtimeout = 10 ) { $ timestart = time ( ) ; $ buff = '' ; while ( true ) { $ buff .= $ this -> recvChr ( ) ; $ timerun = time ( ) - $ timestart ; if ( preg_match ( "/$str/" , $ buff , $ matches ) ) { return true ; } if ( $ timerun >= $ maxtimeout ) { throw new TelnetException ( "Could not find occurance [ $str ] within timeout" ) ; } } return false ; }
Wait for specified message from socket till timeout

@param string    $str            String to wait
@param int       $maxtimeout     Maximum timeout to wait

@throws  SocketClientException    On socket communication error
@throws  TelnetException          If maxtimeout reached
@return  bool    True if found
Wait for specified message from socket till timeout