Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[paho-dev] Resource temporarily unavailable

Hi, new to the list, new to mqtt, loving it so far.

I have small message feeds working great, both publish and subscribe, now Im trying to publish a ~90KB file and am getting what looks like a socket error on loop, see below.

from searching the issue I found a loop_forever is needed when sending binaries/files, when i added the loop_forever, the resource unavailable error started. without the loop_forever, the file just wouldn’t send, the client would exit immediately with nothing sent.

Any input or feedback much appreciated.

client OS is angstrom linux

~# python 
Traceback (most recent call last):
  File "", line 20, in <module>
    rc = mqttc.loop(2)
  File "/usr/lib/python2.7/site-packages/paho/mqtt/", line 790, in loop
socket.error: [Errno 11] Resource temporarily unavailable

here’s my client code

:~# cat
import paho.mqtt.client as mqtt

def on_publish(foo, userdata, bar):
  # Disconnect after our message has been sent.
    print "published"

mqttc = mqtt.Client()
mqttc.on_publish = on_publish
mqttc.connect("broker", 1883, 60)

f = open("cap.jpg")
imagestring =
byteArray = bytes(imagestring)
mqttc.publish("caps", byteArray, 1) # tried 0 and 1, no change
#mqttc.loop_forever()		    # tried loop_forever and the below rc checking loop
rc = 0
while rc == 0:
	    rc = mqttc.loop(2)     # tried () and (2), no change
	    print("rc: " + str(rc))

Back to the top