# TCPClient seems to not work without a delay after handshake

**URL:** <https://community.particle.io/t/tcpclient-seems-to-not-work-without-a-delay-after-handshake/10546>\
**Category:** Troubleshooting\
**Created:** [March 10, 2015, 7:59pm UTC](https://community.particle.io/t/tcpclient-seems-to-not-work-without-a-delay-after-handshake/10546 "2015-03-10T19:59:28Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Iv4n](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/iv4n/32/1968_2.png) [@Iv4n](https://community.particle.io/u/Iv4n)\
**Post date:** [March 10, 2015, 9:40pm UTC](https://community.particle.io/t/tcpclient-seems-to-not-work-without-a-delay-after-handshake/10546/3 "2015-03-10T21:40:44Z")

</div>

This is (in my experience and opinion) a bug. @ScuffR, there should not be any need to have a delay, but yes that should fix it. I have had two topics with conversation about this in the forum. `delay(10000)` before `client.connect()` should fix it.

The reason why Serial works is because of the delay of the Spark waiting for you to connect the Serial port.

Here are the topics if anyone is interested:

> **[HTTPclient/TCPClient request not performed inmediately on startup](https://community.particle.io/t/httpclient-tcpclient-request-not-performed-inmediately-on-startup/10243)**
>
> Hello guys, I’m trying to send post/get to a URL as soon as the spark core starts up. I need to be this as soon as possible. I have noticed that If I don’t insert a delay of 5 seconds before the request is done, it is actually never executed. No idea...

> **[TCPClient always fails on first connect attempt after activating WiFi](https://community.particle.io/t/tcpclient-always-fails-on-first-connect-attempt-after-activating-wifi/10357)**
>
> Hi, I’m running in SEMI\_AUTOMATIC mode and finding that after I turn on WiFi and connect to the cloud, the TCPClient will always fail to connect on its first attempt. Subsequent attempts are fine. I’ve been careful to ensure everything is set up...

---

_[View the full topic](https://community.particle.io/t/tcpclient-seems-to-not-work-without-a-delay-after-handshake/10546)._
