Pico W SDK: 1.4.0
IDE: CLion on Ubuntu 22.04 running on a PC:
GCC: 11.2.0 (Ubuntu 11.2.0-19ubuntu1)
MQTT broker/server: Mosquitto 2.0.15 running on Ubuntu 22.04.
Issue: MQTT with keep_alive=0 (zero) causes invalid arguments on broker/server and the connection terminates.
....
/* Initialize and configure the client info structure */
struct mqtt_connect_client_info_t clientInfo;
clientInfo.client_id = MQTT_CLIENT_ID;
clientInfo.client_user = MQTT_USER;
clientInfo.client_pass = MQTT_USER_PASSWD;
clientInfo.keep_alive = 0; <<<<<<<<<<<<< NOTE THIS !!!!!!!!!!!!!!!!!!!!!!!!!
clientInfo.will_topic = NULL; // set to NULL if will is not to be used, will_msg, will_qos and will retain are then ignored
clientInfo.will_msg = NULL;
clientInfo.will_qos = 0;
clientInfo.will_retain = 0;
err = mqtt_client_connect(
client,
&brokerAddr,
MQTT_PORT,
mqttConnectionCallback,
NULL,
&clientInfo
);
....
Generates the following log entries on the Mosquitto broker/server:
1666604114: New connection from 10.3.17.135:53231 on port 1883.
1666604114: New client connected from 10.3.17.135:53231 as picow (p2, c1, k0, u'test').
1666604114: Bad socket read/write on client picow: Invalid arguments provided.
Pico W SDK: 1.4.0 IDE: CLion on Ubuntu 22.04 running on a PC: GCC: 11.2.0 (Ubuntu 11.2.0-19ubuntu1) MQTT broker/server: Mosquitto 2.0.15 running on Ubuntu 22.04.
Issue: MQTT with keep_alive=0 (zero) causes invalid arguments on broker/server and the connection terminates.
Generates the following log entries on the Mosquitto broker/server: