Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Correct way to recover from broker disconnect?

Theres's code in there to restart SSL sessions with the OpenSSL quick resume (or whatever it's called) option.  Could be something to do with that.

If you can share a bit more of your code (SSL and connect setup, and reconnect logic) then I'll take a look when I can.

Ian

On 30/01/14 18:53, Jimmy Johnson wrote:
Hi Ian,

    It seems to have something to do with the SSL socket.  I can reconnect fine if I don't connect using OpenSSL.

Jimmy


Jimmy,

the right way is to call MQTTClient_connect, as you seem to be doing.   You don't need to create another client object.

Are you using the latest client code?

Ian


On 29/01/14 21:57, Jimmy Johnson wrote:

Hello,

I am using the paho C client over ssl to connect to a mosquito broker.  In tests when the broker is restarted the client disconnects but I am unable to reconnect to the broker by simply calling the MQTTClient_connect routine.  What is the best way to reconnect to a broker that goes down?  Am I missing an interim step? Do I need to create a whole new client handle before trying to reconnect?

I am getting the following errors when trying to reconnect using the same client handle that just got disconnected:

20140129 183737.764 New socket 7 for m10.cloudmqtt.com, port 20893
20140129 183737.764 (3051354944)     (4)> Socket_addSocket:162
20140129 183737.764 (3051354944)      (5)> Socket_setnonblocking:72
20140129 183737.764 (3051354944)      (5)< Socket_setnonblocking:77 (0)
20140129 183737.764 (3051354944)     (4)< Socket_addSocket:175 (0)
20140129 183737.764 (3051354944)     (4)> Socket_error:94
20140129 183737.764 (3051354944)     (4)< Socket_error:103 (115)
20140129 183737.764 Connect pending
20140129 183737.764 (3051354944)    (3)< Socket_new:682 (115)
20140129 183737.764 (3051354944)   (2)< MQTTProtocol_connect:130 (115)
20140129 183737.764 (3051354944)   (2)> MQTTClient_waitfor:1532
20140129 183737.764 (3051354944)    (3)> Thread_wait_sem:263
20140129 183737.764 (3051354944)    (3)< Thread_wait_sem:284 (0)
20140129 183737.764 (3051354944)   (2)< MQTTClient_waitfor:1614 (-3)
20140129 183737.764 (3051354944)   (2)> MQTTClient_disconnect1:1065
20140129 183737.764 (3051354944)    (3)> MQTTClient_closeSession:645

Thanks,
Jimmy



_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/paho-dev



_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/paho-dev


Back to the top