lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] lwip, mqtt and mbedtls


From: Manu Abraham
Subject: [lwip-users] lwip, mqtt and mbedtls
Date: Fri, 21 Aug 2020 00:03:19 +0530

Hi,

I have been trying to use mqtt from lwip-2.1.2 alongwith mqtt and mbedtls.
Trying to connect to a running mosquitto on a PC (192.168.1.34)

I see that mqtt uses alttcp as a wrapper, which connects to mbedtls,
which uses lwip_tcp

But, looking at

void
mqtt_example_init(void)
{
#if LWIP_TCP
  mqtt_client = mqtt_client_new();

  mqtt_set_inpub_callback(mqtt_client,
          mqtt_incoming_publish_cb,
          mqtt_incoming_data_cb,
          LWIP_CONST_CAST(void*, &mqtt_client_info));

  mqtt_client_connect(mqtt_client,
          &mqtt_ip, MQTT_PORT,
          mqtt_connection_cb, LWIP_CONST_CAST(void*, &mqtt_client_info),
          &mqtt_client_info);
#endif /* LWIP_TCP */
}

from contrib/mqtt_example.c, it gets connected over tcp.
Trying to connect using tcp, I get the following debug trace

 IPv4 Address     : 192.168.1.33
 IPv4 Subnet mask : 255.255.255.0
 IPv4 Gateway     : 192.168.1.1

 Lease period: 86400s, Renew in: 43200s, Rebind in: 75600s

 (1150) mqtt_example_init: Initializing MQTT client
 (1161) mqtt_example_init: Connecting to MQTT Broker:192.168.1.34:8883
tcp_bind: bind to port 52032
mqtt_client_connect: Connecting to host: 192.168.1.34 at port:8883
tcp_connect to port 8883
mqtt_tcp_connect_cb: TCP connection established to server
mqtt_output_send: tcp_sndbuf: 5840 bytes, ringbuf_linear_available:
18, get 0, put 18
mqtt_tcp_err_cb: TCP error callback: error -14, arg: 30044044
MQTT client "test" connection cb: status 256
tcp_pcb_purge
tcp_pcb_purge: data left on ->unacked
tcp_slowtmr: no active pcbs
 (109) print_dhcp_state: Test MQTT publish
Assertion "mqtt_publish: TCP disconnected" failed at line 1110 in
D:\Work\LWIP\lwip-2.1.2\src\apps\mqtt\mqtt.c
 (1219) publish_data: Publish err: -11



So, how should one connect MQTT when using mbedtls ?

Can someone help ?

Thanks,

Manu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]