Discussion:
Python mqtt server error
(too old to reply)
p***@gmail.com
2018-05-29 11:37:16 UTC
Permalink
File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 768, in connect
return self.reconnect()
File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 895, in reconnect
sock = socket.create_connection((self._host, self._port), source_address=(self._bind_address, 0))
File "/usr/lib/python2.7/socket.py", line 575, in create_connection
raise err
socket.error: [Errno 113] No route to host


i found error when cannected to a raspberry pi Mqttp server




import paho.mqtt.client as mqtt

MQTT_SERVER = "localhost"
MQTT_PATH = "test_channel"

# The callback for when the client receives a CONNACK response from the server.
def on_connect(client, userdata, flags, rc):
print("Connected with result code "+str(rc))

# Subscribing in on_connect() means that if we lose the connection and
# reconnect then subscriptions will be renewed.
client.subscribe(MQTT_PATH)

# The callback for when a PUBLISH message is received from the server.
def on_message(client, userdata, msg):
print(msg.topic+" "+str(msg.payload))
# more callbacks, etc

client = mqtt.Client()
client.on_connect = on_connect
client.on_message = on_message

client.connect(MQTT_SERVER, 1883, 60)

# Blocking call that processes network traffic, dispatches callbacks and
# handles reconnecting.
# Other loop*() functions are available that give a threaded interface and a
# manual interface.
client.loop_forever()




this is python code
--
You received this message because you are subscribed to the Google Groups "mnemosyne-proj-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mnemosyne-proj-users+***@googlegroups.com.
To post to this group, send email to mnemosyne-proj-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mnemosyne-proj-users/8a010358-8dad-415d-bc6c-ffb0a9505d48%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Peter Bienstman
2018-05-29 11:53:31 UTC
Permalink
Hi,

I'm afraid Mnemosyne has nothing to do with mqtt, so perhaps you're asking something on the wrong mailing list?

Cheers,

Peter

-----Original Message-----
From: mnemosyne-proj-***@googlegroups.com <mnemosyne-proj-***@googlegroups.com> On Behalf Of ***@gmail.com
Sent: 29 May 2018 13:37
To: mnemosyne-proj-users <mnemosyne-proj-***@googlegroups.com>
Subject: [mnemosyne-proj-users] Python mqtt server error

File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 768, in connect
return self.reconnect()
File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 895, in reconnect
sock = socket.create_connection((self._host, self._port), source_address=(self._bind_address, 0))
File "/usr/lib/python2.7/socket.py", line 575, in create_connection
raise err
socket.error: [Errno 113] No route to host


i found error when cannected to a raspberry pi Mqttp server




import paho.mqtt.client as mqtt

MQTT_SERVER = "localhost"
MQTT_PATH = "test_channel"

# The callback for when the client receives a CONNACK response from the server.
def on_connect(client, userdata, flags, rc):
print("Connected with result code "+str(rc))

# Subscribing in on_connect() means that if we lose the connection and
# reconnect then subscriptions will be renewed.
client.subscribe(MQTT_PATH)

# The callback for when a PUBLISH message is received from the server.
def on_message(client, userdata, msg):
print(msg.topic+" "+str(msg.payload))
# more callbacks, etc

client = mqtt.Client()
client.on_connect = on_connect
client.on_message = on_message

client.connect(MQTT_SERVER, 1883, 60)

# Blocking call that processes network traffic, dispatches callbacks and # handles reconnecting.
# Other loop*() functions are available that give a threaded interface and a # manual interface.
client.loop_forever()




this is python code

--
You received this message because you are subscribed to the Google Groups "mnemosyne-proj-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mnemosyne-proj-users+***@googlegroups.com.
To post to this group, send email to mnemosyne-proj-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mnemosyne-proj-users/8a010358-8dad-415d-bc6c-ffb0a9505d48%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "mnemosyne-proj-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mnemosyne-proj-users+***@googlegroups.com.
To post to this group, send email to mnemosyne-proj-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mnemosyne-proj-users/1acce884340946a481cd4b8772585e7e%40xmail102.UGent.be.
For more options, visit https://groups.google.com/d/optout.
Loading...