Closed ckrey closed 8 years ago
I think maybe client side tcp connection going down, server can't send packet to client. Please check and debug line 123 with Serial.println.
while (!_client->available()) {
unsigned long t = millis();
if (t-lastInActivity > MQTT_KEEPALIVE*1000UL) {
_client->stop();
Serial.println("can't read from server packet");
return false;
}
}
uint8_t llen;
uint16_t len = readPacket(&llen);
Serial.print("read packet length : ");
Serial.println("len");
if (len == 4 && buffer[3] == 0) {
lastInActivity = millis();
pingOutstanding = false;
Serial.println("read packet OK");
return true;
}
}
Serial.println("read packet fail");
_client->stop();
It seems to be a general TCP problem of the electron.
https://community.particle.io/t/solved-electron-tcpclient-weirdness/20771
I did install the beta firmware 0.5.0.-rc1 and had no problem using MQTT afterwards
I try to run a small GPS .ino on an Electron 2G. The same .ino works great on a Photon.
any hints?
mosquitto server logs: