Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Paho » C client connection time(C client connection time is too big, more than 100 mS)
C client connection time [message #1753321] Fri, 03 February 2017 20:03
Alexey Sergeev is currently offline Alexey SergeevFriend
Messages: 1
Registered: January 2017
Junior Member
Hello,
Paho client is preferred MQTT client library for our future project. But we have an issue with client connection time. We are in favor of using C paho client library.
We know the root cause of the issue.

While connecting (MQTTClient_connect method) the client uses MQTTClient_waitfor method to check if the socket is ready for writing:
MQTTClient.c, line 826
MQTTClient_waitfor(handle, CONNECT, &rc, millisecsTimeout - MQTTClient_elapsed(start));
The MQTTClient_waitfor method in turn executes MQTTClient_cycle with a hard-coded delay:
MQTTClient.c, line 1682:
pack = MQTTClient_cycle(&sock, 100L, rc);
The delay is used as a timeout parameter for the select method waiting for any socket ready for reading data:
Socket.c, loine 241:
select(s.maxfdp1, &(s.rset), &pwset, NULL, &timeout)
The problem is that as soon as we are still connecting there are no any incoming messages so there is no data to read and the select method gets blocked for the specified timeout which is 100 mS.
As a result MQTTClient_connect method runs for more than 100 mS.

I wonder was there in intention to block the MQTTClient_connect method or that is a bug? Without the hard-coded timeout the connection time can be reduced to a 0.5 mS.
If that is a bug, can that be fixed in one of the next releases?
Thanks you very much.



Previous Topic:Connection to a virtual host using android library
Next Topic:Paho C messageArrived callback
Goto Forum:
  


Current Time: Fri Apr 26 20:00:44 GMT 2024

Powered by FUDForum. Page generated in 0.03253 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top