activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From roox_4000 <reza.mazar...@gmail.com>
Subject Re: ActiveMQ(MQTT) crash when subscribe
Date Sat, 04 Jul 2015 05:20:03 GMT
I Try With v5.12 Snapshot But activemq console give me laste error :

WARN : Transport Connection to :tcp://127.0.0.1:18967 
     failed:java.io.IOExeption:Unexpected error 
     occurred:java.lang.ArrayIndexOutOfBoundsException :12 

That 12 in Above Error Equal With Topic Character That I Enter In Subscribe
Method

chat/general =12 Character

$topics['*chat/general*'] = array("qos"=>0, "function"=>"procmsg"); 
$mqtt->subscribe($topics,0); 


This Subscribe Part Of phpMQTT Class (bluerhinos)  Tht I Use It 

  /* subscribe: subscribes to topics */ 
        function subscribe($topics, $qos = 0){ 
                $i = 0; 
                $buffer = ""; 
                $id = $this->msgid; 
                $buffer .= chr($id >> 8);  $i++; 
                $buffer .= chr($id % 256);  $i++; 

                foreach($topics as $key => $topic){ 
                        $buffer .= $this->strwritestring($key,$i); 
                        $buffer .= chr($topic["qos"]);  $i++; 
                        $this->topics[$key] = $topic; 
                } 

                $cmd = 0x80; 
                //$qos 
                $cmd +=	($qos << 1); 


                $head = chr($cmd); 
                $head .= chr($i); 
                
                fwrite($this->socket, $head, 2); 
                fwrite($this->socket, $buffer, $i); 
                $string = $this->read(2); 
                
                $bytes = ord(substr($string,1,1)); 
                $string = $this->read($bytes); 
        } 







--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-MQTT-crash-when-subscribe-tp4698367p4698578.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message