Just setup the pre-release 0.5.0 firmware from the web IDE and then pushed some local code to the device through the Particle Desktop IDE. I’m getting a hard fault when I call a function that sets up a TCP client that worked with 0.4.9. Here is the test code that is faulting
int dataLoad(String args) {
byte server333[] = { 74, 125, 224, 72 }; // Google
if (client.connect(server333, 80)) {
return 200;
}
return 404;
}
When calling $ particle call 3800***************** dataLoad 1
I don’t own a P1, but this code works on the Photon when I replace the host address with an existing one.
But even with that IP I don’t get a hard fault.
And the device restarts after a short timeout with no returns. I’m able to netcat a TCP connection without a problem and my server never sees a connection from the P1.
As soon as I reverted to 0.4.9, it worked without a hitch - returns 200 with the server picking up the connection from the P1. No other changes in code
I tried your previous app and it worked fine - there’s no problem with TCPClient.connect().
The changes you mentioned above are more suspect. You don’t need the waitFor() command since client.connect() blocks until connected or it fails. (In fact, waitFor will call the background loop, which isn’t supported from within a Cloud function. I will add a check for this from within the firmware to make waitFor() do something sensible here.) Having said that, I’m still not able to reproduce a SOS with the code, adding a waitFor() in the function. Could you please give a complete code example that shows the problem so that I can be certain I’m testing the same thing.