Hi,
I tried to use the MQTT example and found that the comm_open is called twice. So the create_socket function is called twice. I am using this in multi server connection mode. But I am trying to connect it to only one server.
On digging deeper, I found a UDP Socket is created by the Osi task "VMqttRecvTask" through a function mqtt_client_run(g_wait_secs).
Also a TCP socket is created by sl_ExtLib_MqttClientConnect during the actual connection to the broker.
I am just using the TCP socket, but would like to know why does a UDP socket is created through the receive task. As no activity is observed on the UDP socket the program runs fine during Socket_Listen, but my application gets complicated in managing two socket ids, though I will be using only the socket id of TCP connection.
TCP - Connection Flow:
sl_ExtLib_MqttClientConnect -> mqtt_connect_msg_send - > connect_msg_send -> cl_ctx_conn_state_try_locked -> net_connect ->
net_ops->open(client->nwconn_opts | DEV_NETCONN_OPT_TCP.....)
UDP - Connection Flow:
VMqttRecvTask - > mqtt_client_run -> grp_net_setup_create-> net_ops->open(DEV_NETCONN_OPT_UDP...)..
Am I missing something here..