USE YHTANG AWS ACCOUNT TO TEST MQTT
Dependents: NuMaker-mbed-AWS-IoT-example
Diff: MQTTClient.h
- Revision:
- 56:71ae1a773b64
- Parent:
- 54:ff9e5c4b52d0
- Child:
- 57:3513ee54ebb4
--- a/MQTTClient.h Sat Sep 30 16:46:21 2017 +0000 +++ b/MQTTClient.h Tue Oct 03 22:51:58 2017 +0000 @@ -382,13 +382,13 @@ int rc = FAILURE, sent = 0; - while (sent < length && !timer.expired()) + do { rc = ipstack.write(&sendbuf[sent], length - sent, timer.left_ms()); if (rc < 0) // there was an error writing the data break; sent += rc; - } + } while (sent < length && !timer.expired()); if (sent == length) { if (this->keepAliveInterval > 0) @@ -400,7 +400,7 @@ #if defined(MQTT_DEBUG) char printbuf[150]; - DEBUG("Rc %d from sending packet %s\n", rc, + DEBUG("Rc %d from sending packet %s\r\n", rc, MQTTFormat_toServerString(printbuf, sizeof(printbuf), sendbuf, length)); #endif return rc; @@ -480,7 +480,7 @@ if (rc >= 0) { char printbuf[50]; - DEBUG("Rc %d receiving packet %s\n", rc, + DEBUG("Rc %d receiving packet %s\r\n", rc, MQTTFormat_toClientString(printbuf, sizeof(printbuf), readbuf, len)); } #endif @@ -688,8 +688,7 @@ { rc = FAILURE; // session failure #if defined(MQTT_DEBUG) - char printbuf[150]; - DEBUG("PINGRESP not received in keepalive interval\n"); + DEBUG("PINGRESP not received in keepalive interval\r\n"); #endif } }