TCPClient hangs up core

I appreciate the thought and the help. Unfortunately the simple answer is “no.” I can’t get cli nor nodejs to work so I’m buying a serial LCD and will try to discover the IP address that way.

Hi @captnkrunch,

I’m not sure if you’ve tried this yet, but one alternative would be to store the IP address for your core in a Spark.variable. I’ve done this a few times with my apps to more easily find my core locally, here’s some code:

char myIpString[24];
uint8_t gotIP = 0;

void setup()
{
    Spark.variable("ipAddress", myIpString, STRING);
}

void loop()
{
    checkSetIPAddress();
}


void checkSetIPAddress() {
    if (gotIP) {
        return;
    }
    
    IPAddress myIp = Network.localIP();
    sprintf(myIpString, "%d.%d.%d.%d", myIp[0], myIp[1], myIp[2], myIp[3]);
    gotIP = (myIpString != "0.0.0.0");
}

Also please feel free to ping me directly if there is something broken about the spark-cli, I will get to spend some time on it this sprint so I’d like to improve as much as possible while it’s in focus.

Thanks!
David

1 Like

I was able to get cli running. apparently i didn’t appreciate how long it takes to install so I was cutting it off prematurely before. now I’m getting a 404 error when attempting to verify the code you suggested. ah well. I am grateful for the help though.

@dave,

I’ll open up issues in spark-cli for those undone features.

My pull request has been sitting for weeks :smiley:

1 Like

ooops. apparently the 404 was an artifact of firefox and openssl issue. Chrome works fine. Thanks again.

2 Likes

I’ve been traveling for weeks! :slight_smile:

1 Like

Cool, glad it’s working now!

Maybe you guys need to post the status of the :spark: team members on the spark.io/status. haha!

There has been talk of a Spark powered http://harrypotter.wikia.com/wiki/Weasley_Clock

Hi, I know this is an old thread but I think I’m having this same issue now. If anyone could check and see if it’s my code or indeed a TCPClient issue I’d be most greatful, my code is in a thread I created here Thanks, Rick.

I don’t know if anyone has solved this problem, but I think I have a solution.

while(!client.available()) Particle.process();

This checks the client and keeps the connection to the cloud active. The delay function does this automatically behind the scenes, but if you have a tight loop that doesn’t go back to the Photons internal firmware by falling out of the loop function or calling the delay function, the Photon disconnects.