Hi! I’m developing a SW to connect with mosquitto broker. I started from the source code in apps/platformservices of Legato environment.
I can right build the project, create the session, but I have problem when I have to connect to the broker:
I’m trying to connect without user and password (I’m beginning!) and this is the result:
yes, the problem is in the following function:
le_result_t mqtt_Connect
(
mqtt_SessionRef_t sessionRef ///< [IN] Session to connect
)
{
mqtt_Session* s = le_ref_Lookup(SessionRefMap, sessionRef);
if (s == NULL)
{
LE_KILL_CLIENT(“Session doesn’t exist”);
return LE_FAULT;
}
if (s->clientSession != mqtt_GetClientSessionRef())
{
LE_KILL_CLIENT(“Session doesn’t belong to this client”);
return LE_FAULT;
}
** LE_WARN(“Socket error”);**
** result = LE_FAULT;**
** break;**
case MQTTCLIENT_NULL_PARAMETER:
case MQTTCLIENT_BAD_STRUCTURE:
case MQTTCLIENT_BAD_UTF8_STRING:
result = LE_BAD_PARAMETER;
break;
case MQTTCLIENT_SUCCESS:
result = LE_OK;
break;
default:
LE_WARN("Paho connect returned (%d)", connectResult);
result = LE_FAULT;
break;
}
return result;
I’m trying to debug and study this function, but the error is always the same I don’t know if it is a connection error… . Anyway I also unsandboxed the application and also in this case the result is the same:
I can ping 8.8.8.8 so it is not a connection error. I installed mosquitto server on my VM with the command line ctrl sudo snap install mosquitto and I can publish and subscribe a message in local host (opening two terminals)
On the other side, if I put in the code the AirVantage broker adress, I see:
Sorry but I can’t see this function…
EDIT oh maybe do you refer to MQTTClient_connect in const int connectResult = MQTTClient_connect(s->client, &s->connectOptions);
I don’t see problems in this function…
and i don’t see problems in MQTTClient_connect, also because I did not modify the function and it works well to other users that I saw on the forum.
Is there a way to see on the terminal if my board can “talk” with mqtt mosquitto broker at the adress tcp://192.168.2.3:1883?
What do you mean by “it is a permission problem”?
Why suddenly it works?
BTW, you can capture wireshark log in ubuntu and see if there is incoming packet on port 1883?
I meant that maybe there could be communication problems with the 1883 gate … I can’t give myself any other explanations. Do you happen to know how to see active ports on Ubuntu (how to open wireshark log for this port)? I simply installed Mosquitto and activated the session locally: might it not be enough?