Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQTT with keep_alive=0 (zero) causes invalid arguments on broker/server and the connection terminates. #47

Open
vstokesjr opened this issue Oct 24, 2022 · 0 comments

Comments

@vstokesjr
Copy link

vstokesjr commented Oct 24, 2022

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.
@vstokesjr vstokesjr changed the title MQTT with with keep_alive=0 (zero) causes invalid arguments on broker/server and the connection terminates. MQTT with keep_alive=0 (zero) causes invalid arguments on broker/server and the connection terminates. Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant