コード例 #1
0
ファイル: Socket.php プロジェクト: olivier1980/alpharpc
 /**
  * Send a Messsage.
  *
  * @param Message $msg
  *
  * @return Socket
  */
 public function msend(Message $msg)
 {
     if (ZMQ::SOCKET_ROUTER === $this->getSocketType()) {
         $msg->prepend($msg->getRoutingInformation());
     }
     if ($this->verbose) {
         $this->getLogger()->debug('SEND: ' . $this->id);
         $this->getLogger()->debug($msg);
     }
     $parts = $msg->toArray();
     $iMax = count($parts) - 1;
     if ($iMax < 0) {
         throw new RuntimeException('No parts to send.');
     }
     for ($i = 0; $i < $iMax; $i++) {
         $this->send($parts[$i], ZMQ::MODE_SNDMORE);
     }
     $this->send($parts[$iMax]);
     if ($this->verbose) {
         $this->getLogger()->debug('Message sent.');
     }
     return $this;
 }