src/PAMI/Client/Impl/ClientImpl.php
public function send(OutgoingMessage $message)
    {
        $messageToSend = $message->serialize();
        $length = strlen($messageToSend);
        $this->logger->debug(
            '------ Sending: ------ ' . "\n" . $messageToSend . '----------'
        );
        $this->lastActionId = $message->getActionId();
        if (@fwrite($this->socket, $messageToSend) < $length) {
            throw new ClientException('Could not send message');
        }
        $read = 0;
        while ($read <= $this->rTimeout) {
            $this->process();
            $response = $this->getRelated($message);
            if ($response != false) {
                $this->lastActionId = false;
                return $response;
            }
            usleep(1000); // 1ms delay
            if ($this->rTimeout > 0) {
                $read++;
            }
        }
        throw new ClientException('Read timeout');
    }
public function send(OutgoingMessage $message)
    {
        $messageToSend = $message->serialize();
        $length = strlen($messageToSend);
        $this->logger->debug(
            '------ Sending: ------ ' . "\n" . $messageToSend . '----------'
        );
        $this->lastActionId = $message->getActionId();
        if (@fwrite($this->socket, $messageToSend) < $length) {
            throw new ClientException('Could not send message');
        }
        $read = 0;
        while ($read <= $this->rTimeout) {
            $this->process();
            $response = $this->getRelated($message);
            if ($response != false) {
                $this->lastActionId = false;
                return $response;
            }
            usleep(1000); // 1ms delay
            if ($this->rTimeout > 0) {
                $read++;
            }
        }
        throw new ClientException('Read timeout');
    }
public function send ( OutgoingMessage $ message ) { $ messageToSend = $ message -> serialize ( ) ; $ length = strlen ( $ messageToSend ) ; $ this -> logger -> debug ( '------ Sending: ------ ' . "\n" . $ messageToSend . '----------' ) ; $ this -> lastActionId = $ message -> getActionId ( ) ; if ( @ fwrite ( $ this -> socket , $ messageToSend ) < $ length ) { throw new ClientException ( 'Could not send message' ) ; } $ read = 0 ; while ( $ read <= $ this -> rTimeout ) { $ this -> process ( ) ; $ response = $ this -> getRelated ( $ message ) ; if ( $ response != false ) { $ this -> lastActionId = false ; return $ response ; } usleep ( 1000 ) ; // 1ms delay if ( $ this -> rTimeout > 0 ) { $ read ++ ; } } throw new ClientException ( 'Read timeout' ) ; }
Sends a message to ami.

@param \PAMI\Message\OutgoingMessage $message Message to send.

@see ClientImpl::send()
@throws \PAMI\Client\Exception\ClientException
@return \PAMI\Message\Response\ResponseMessage
Sends a message to ami .