The biggest problem I see there is that you're attempting to connect to MQTT every time you send a message, but never disconnect. You can issue a client.disconnect() call at the end of your message processing block.
Or you can remain permanently connected - move your connect call to the setup() function. My client using the same library that does this is at https://bitbucket.org/pjhardy/rf24sensornet/src/cfba9e81d8327dba161c3fa2040ab22a0eb7ee83/examples/MqttRelay/MqttRelay.ino?at=master . I could use some logic to check with client.connected() and reconnect if necessary, but it's been very stable.
If all that fails, I'd then look in to the ethernet cable I was using. Try replacing it and seeing if you get better results.
--
You received this message because you are subscribed to the Google Groups "openhab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openhab+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
Visit this group at http://groups.google.com/group/openhab.
For more options, visit https://groups.google.com/d/optout.