Esempio n. 1
0
 public function testHexDump()
 {
     $htmlOutput = false;
     $uppercase = false;
     $return = true;
     $res = MiscHelper::hexdump('FM', $htmlOutput, $uppercase, $return);
     $this->assertRegExp('/000\\s+46 4d\\s+FM/', $res);
     $uppercase = true;
     $res = MiscHelper::hexdump('FM', $htmlOutput, $uppercase, $return);
     $this->assertRegExp('/000\\s+46 4D\\s+FM/', $res);
 }
 public function write($data)
 {
     if ($this->debug) {
         MiscHelper::debug_msg("< [hex]:\n" . MiscHelper::hexdump($data, $htmloutput = false, $uppercase = true, $return = true));
     }
     $this->getIO()->write($data);
 }
 /**
  * @param $data
  */
 public function write($data)
 {
     if ($this->debug) {
         MiscHelper::debug_msg(sprintf('< [hex]: %s%s', PHP_EOL, MiscHelper::hexdump($data, $htmloutput = false, $uppercase = true, $return = true)));
     }
     try {
         $this->getIO()->write($data);
     } catch (AMQPRuntimeException $e) {
         $this->setIsConnected(false);
         throw $e;
     }
 }
 protected function write($data)
 {
     if ($this->debug) {
         MiscHelper::debug_msg("< [hex]:\n" . MiscHelper::hexdump($data, $htmloutput = false, $uppercase = true, $return = true));
     }
     $len = strlen($data);
     while (true) {
         if (false === ($written = fwrite($this->sock, $data))) {
             throw new AMQPRuntimeException("Error sending data");
         }
         if ($written === 0) {
             throw new AMQPRuntimeException("Broken pipe or closed connection");
         }
         // get status of socket to determine whether or not it has timed out
         $info = stream_get_meta_data($this->sock);
         if ($info['timed_out']) {
             throw new \Exception("Error sending data. Socket connection timed out");
         }
         $len = $len - $written;
         if ($len > 0) {
             $data = substr($data, 0 - $len);
         } else {
             break;
         }
     }
 }
 /**
  * @param $data
  */
 public function write($data)
 {
     if ($this->debug) {
         MiscHelper::debug_msg(sprintf('< [hex]: %s%s', PHP_EOL, MiscHelper::hexdump($data, $htmloutput = false, $uppercase = true, $return = true)));
     }
     $this->getIO()->write($data);
 }