# TCPClient hangs up core

**URL:** <https://community.particle.io/t/tcpclient-hangs-up-core/946>\
**Category:** Troubleshooting\
**Created:** [December 23, 2013, 8:57am UTC](https://community.particle.io/t/tcpclient-hangs-up-core/946 "2013-12-23T08:57:53Z")\
**Posts on this page:** 12\
**Page:** 3

<div class="post-metadata">

**Author:** ![captnkrunch](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/captnkrunch/32/1589_2.png) [@captnkrunch](https://community.particle.io/u/captnkrunch)\
**Post date:** [April 21, 2014, 5:27pm UTC](https://community.particle.io/t/tcpclient-hangs-up-core/946/42 "2014-04-21T17:27:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dave/32/181_2.png) [@Dave](https://community.particle.io/u/Dave)\
**Post date:** [April 21, 2014, 8:15pm UTC](https://community.particle.io/t/tcpclient-hangs-up-core/946/43 "2014-04-21T20:15:36Z")

</div>

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");
}

```

---

<div class="post-metadata">

**Author:** ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dave/32/181_2.png) [@Dave](https://community.particle.io/u/Dave)\
**Post date:** [April 21, 2014, 8:17pm UTC](https://community.particle.io/t/tcpclient-hangs-up-core/946/44 "2014-04-21T20:17:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![captnkrunch](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/captnkrunch/32/1589_2.png) [@captnkrunch](https://community.particle.io/u/captnkrunch)\
**Post date:** [April 22, 2014, 2:41am UTC](https://community.particle.io/t/tcpclient-hangs-up-core/946/45 "2014-04-22T02:41:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kennethlimcp](https://avatars.discourse-cdn.com/v4/letter/k/c0e974/32.png) [@kennethlimcp](https://community.particle.io/u/kennethlimcp)\
**Post date:** [April 22, 2014, 3:06am UTC](https://community.particle.io/t/tcpclient-hangs-up-core/946/46 "2014-04-22T03:06:55Z")

</div>

@dave,

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

My pull request has been sitting for weeks 😃

---

<div class="post-metadata">

**Author:** ![captnkrunch](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/captnkrunch/32/1589_2.png) [@captnkrunch](https://community.particle.io/u/captnkrunch)\
**Post date:** [April 22, 2014, 3:18am UTC](https://community.particle.io/t/tcpclient-hangs-up-core/946/47 "2014-04-22T03:18:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dave/32/181_2.png) [@Dave](https://community.particle.io/u/Dave)\
**Post date:** [April 22, 2014, 1:04pm UTC](https://community.particle.io/t/tcpclient-hangs-up-core/946/48 "2014-04-22T13:04:14Z")

</div>

I’ve been traveling for weeks! 🙂

---

<div class="post-metadata">

**Author:** ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dave/32/181_2.png) [@Dave](https://community.particle.io/u/Dave)\
**Post date:** [April 22, 2014, 1:04pm UTC](https://community.particle.io/t/tcpclient-hangs-up-core/946/49 "2014-04-22T13:04:28Z")

</div>

Cool, glad it’s working now!

---

<div class="post-metadata">

**Author:** ![kennethlimcp](https://avatars.discourse-cdn.com/v4/letter/k/c0e974/32.png) [@kennethlimcp](https://community.particle.io/u/kennethlimcp)\
**Post date:** [April 22, 2014, 1:06pm UTC](https://community.particle.io/t/tcpclient-hangs-up-core/946/50 "2014-04-22T13:06:58Z")

</div>

Maybe you guys need to post the status of the :spark: team members on the [spark.io/status](http://spark.io/status). haha!

---

<div class="post-metadata">

**Author:** ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dave/32/181_2.png) [@Dave](https://community.particle.io/u/Dave)\
**Post date:** [April 22, 2014, 1:31pm UTC](https://community.particle.io/t/tcpclient-hangs-up-core/946/51 "2014-04-22T13:31:59Z")

</div>

There has been talk of a Spark powered [http://harrypotter.wikia.com/wiki/Weasley\_Clock](http://harrypotter.wikia.com/wiki/Weasley_Clock)

---

<div class="post-metadata">

**Author:** ![rickpbush](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickpbush/32/1247_2.png) [@rickpbush](https://community.particle.io/u/rickpbush)\
**Post date:** [January 21, 2015, 7:54pm UTC](https://community.particle.io/t/tcpclient-hangs-up-core/946/52 "2015-01-21T19:54:58Z")

</div>

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](http://community.spark.io/t/post-binary-data-to-a-serverside-php-cgi/9515) Thanks, Rick.

---

<div class="post-metadata">

**Author:** ![jbstcyr](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jbstcyr/32/7531_2.png) [@jbstcyr](https://community.particle.io/u/jbstcyr)\
**Post date:** [November 4, 2015, 12:44am UTC](https://community.particle.io/t/tcpclient-hangs-up-core/946/54 "2015-11-04T00:44:09Z")

</div>

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.

[Previous page](https://community.particle.io/t/tcpclient-hangs-up-core/946.md?page=2)
