Hi all:
I connect my mqtt server with umqtt。
I have two mqtt servers,one is on Raspberry Pi,the version is 1.4.15 and the other is on bandwagon vps,the version is old :
mosquitto/trusty-updates,trusty-security,now 0.15-2ubuntu1.2 i386 [installed]
MQTT version 3.1 compatible message broker
old but support MQTT v 3.1
the umqtt can work with my mqtt server on raspberry pi very well,but with my vps not working。
the error is:
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "<stdin>", line 2, in <module>
File "<string>", line 11, in <module>
File "simple.py", line 97, in connect
IndexError: bytes index out of range
the line 97 in simple.py is:
96 resp = self.sock.read(4)
97 assert resp[0] == 0x20 and resp[1] == 0x02
98 if resp[3] != 0:
99 raise MQTTException(resp[3])
100 return resp[2] & 1
an i insert a "print(resp)" to watch the result
if connect to raspberry pi ,this result is b"\x20\x00\x00"
but connect with bandwagong vps,the result is b""
who can help me test my host?
my vps host ip is :104.160.34.189
thanks
[solved]A umqtt problem thanks
[solved]A umqtt problem thanks
Last edited by yafengabc on Tue Apr 03, 2018 2:49 am, edited 1 time in total.
Re: A umqtt problem thanks
I compiled a unix version of micropython,and have the same problem:
but i can use command:
mosquitto_pub -h 104.160.34.189 -m "hello" -t "led"
to publish the message
Code: Select all
>>> c=MQTTClient('mq','192.168.43.30')
>>> c.connect()
0
>>> c.publish('led','hi')
>>> c=MQTTClient('mq','104.160.34.189')
>>> c.connect()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "umqtt/simple.py", line 97, in connect
IndexError: bytes index out of range
mosquitto_pub -h 104.160.34.189 -m "hello" -t "led"
to publish the message
Re: A umqtt problem thanks
Maybe this is not a problem with the library
I had install paho-mqtt in python 3.6,and tested the mqtt server on my vps
and unable to publish message too
later I update the mosquitto test
btw: mosquitto_pub and some android app eg. ioT MQTT panel can use it.
I had install paho-mqtt in python 3.6,and tested the mqtt server on my vps
and unable to publish message too
later I update the mosquitto test
btw: mosquitto_pub and some android app eg. ioT MQTT panel can use it.