diff --git a/src/apps/mqtt/mqtt.c b/src/apps/mqtt/mqtt.c index a0d4f953..1929a6dc 100644 --- a/src/apps/mqtt/mqtt.c +++ b/src/apps/mqtt/mqtt.c @@ -1187,13 +1187,14 @@ mqtt_client_new(void) * Connect to MQTT server * @param client MQTT client * @param ip_addr Server IP + * @param port Server port * @param cb Connection state change callback * @param arg User supplied argument to connection callback * @param client_info Client identification and connection options * @return ERR_OK if successful, @see err_t enum for other results */ err_t -mqtt_client_connect(mqtt_client_t *client, const ip_addr_t *ip_addr, mqtt_connection_cb_t cb, void *arg, +mqtt_client_connect(mqtt_client_t *client, const ip_addr_t *ip_addr, u16_t port, mqtt_connection_cb_t cb, void *arg, const struct mqtt_connect_client_info_t *client_info) { err_t err; @@ -1265,10 +1266,10 @@ mqtt_client_connect(mqtt_client_t *client, const ip_addr_t *ip_addr, mqtt_connec LWIP_DEBUGF(MQTT_DEBUG_WARN,("mqtt_client_connect: Error binding to local ip/port, %d\n", err)); goto tcp_fail; } - LWIP_DEBUGF(MQTT_DEBUG_TRACE,("mqtt_client_connect: Connecting to host: %s at port:%d\n", ipaddr_ntoa(ip_addr), MQTT_PORT)); + LWIP_DEBUGF(MQTT_DEBUG_TRACE,("mqtt_client_connect: Connecting to host: %s at port:%"U16_F"\n", ipaddr_ntoa(ip_addr), port)); /* Connect to server */ - err = tcp_connect(client->conn, ip_addr, MQTT_PORT, mqtt_tcp_connect_cb); + err = tcp_connect(client->conn, ip_addr, port, mqtt_tcp_connect_cb); if(err != ERR_OK) { LWIP_DEBUGF(MQTT_DEBUG_TRACE,("mqtt_client_connect: Error connecting to remote ip/port, %d\n", err)); goto tcp_fail; diff --git a/src/include/lwip/apps/mqtt.h b/src/include/lwip/apps/mqtt.h index a0e48bd7..70289903 100644 --- a/src/include/lwip/apps/mqtt.h +++ b/src/include/lwip/apps/mqtt.h @@ -204,7 +204,7 @@ struct mqtt_client_t /** Connect to server */ -err_t mqtt_client_connect(mqtt_client_t *client, const ip_addr_t *ipaddr, mqtt_connection_cb_t cb, void *arg, +err_t mqtt_client_connect(mqtt_client_t *client, const ip_addr_t *ipaddr, u16_t port, mqtt_connection_cb_t cb, void *arg, const struct mqtt_connect_client_info_t *client_info); /** Disconnect from server */ diff --git a/src/include/lwip/apps/mqtt_opts.h b/src/include/lwip/apps/mqtt_opts.h index 7d7d29d9..ffefacd2 100644 --- a/src/include/lwip/apps/mqtt_opts.h +++ b/src/include/lwip/apps/mqtt_opts.h @@ -71,13 +71,6 @@ extern "C" { #define MQTT_REQ_MAX_IN_FLIGHT 4 #endif -/** - * MQTT server port to connect to - */ -#ifndef MQTT_PORT -#define MQTT_PORT 1883 -#endif - /** * Seconds between each cyclic timer call. */