public function sendEcho($cb, $data = 'phpdaemon')
    {
        ++$this->seq;
        if (mb_orig_strlen($data) % 2 !== 0) {
            $data .= "\x00";
        }

        $packet = pack(
                'ccnnn',
                8, // type (c)
                0, // code (c)
                0, // checksum (n)
                Daemon::$process->getPid(), // pid (n)
                $this->seq // seq (n)
            ) . $data;

        $packet = substr_replace($packet, self::checksum($packet), 2, 2);
        $this->write($packet);
        $this->onResponse->push([$cb, microtime(true)]);
    }
public function sendEcho($cb, $data = 'phpdaemon')
    {
        ++$this->seq;
        if (mb_orig_strlen($data) % 2 !== 0) {
            $data .= "\x00";
        }

        $packet = pack(
                'ccnnn',
                8, // type (c)
                0, // code (c)
                0, // checksum (n)
                Daemon::$process->getPid(), // pid (n)
                $this->seq // seq (n)
            ) . $data;

        $packet = substr_replace($packet, self::checksum($packet), 2, 2);
        $this->write($packet);
        $this->onResponse->push([$cb, microtime(true)]);
    }
public function sendEcho ( $ cb , $ data = 'phpdaemon' ) { ++ $ this -> seq ; if ( mb_orig_strlen ( $ data ) % 2 !== 0 ) { $ data .= "\x00" ; } $ packet = pack ( 'ccnnn' , 8 , // type (c) 0 , // code (c) 0 , // checksum (n) Daemon :: $ process -> getPid ( ) , // pid (n) $ this -> seq // seq (n) ) . $ data ; $ packet = substr_replace ( $ packet , self :: checksum ( $ packet ) , 2 , 2 ) ; $ this -> write ( $ packet ) ; $ this -> onResponse -> push ( [ $ cb , microtime ( true ) ] ) ; }
Send echo-request
@param callable $cb Callback
@param string $data Data
@callback $cb ( )
@return void
Send echo - request