# TCPClient.write in loop doesn't transfer data after few kilobytes

**URL:** <https://community.particle.io/t/tcpclient-write-in-loop-doesnt-transfer-data-after-few-kilobytes/15737>\
**Category:** Troubleshooting\
**Created:** [September 19, 2015, 12:46pm UTC](https://community.particle.io/t/tcpclient-write-in-loop-doesnt-transfer-data-after-few-kilobytes/15737 "2015-09-19T12:46:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shax](https://avatars.discourse-cdn.com/v4/letter/s/f05b48/32.png) [@shax](https://community.particle.io/u/shax)\
**Post date:** [September 19, 2015, 12:46pm UTC](https://community.particle.io/t/tcpclient-write-in-loop-doesnt-transfer-data-after-few-kilobytes/15737/1 "2015-09-19T12:46:37Z")

</div>

Hello  
Set such simple enviroment:

on linux box run: **nc -l 30003 \> /tmp/aaa.bin**  
on spark core flash code:

```
int num;
TCPClient client;
byte server[] = { 192, 168, 1, 2 }; // linux IP

void setup()
{
    RGB.control(true);   
    Serial.begin(9600); 
    while(!Serial.available()) SPARK_WLAN_Loop();
    
    while(1){
        num = random(10);
        
        if (client.connected())
        {
            client.write(num);
            Serial.println(F(num));
        }
        else {
            Serial.println(F("connection attempt failed"));
            while(!client.connect(server, 30003))
            { // blink LED if no connection
                RGB.color(0, 0, 0);
                delay(1000);
                RGB.color(100, 100, 100);
                delay(1000);
            }
        }
    }         
}

```

Around a minute (or often less) data collecting in aaa.bin on linux and serial monitor showing random numbers. Then serial monitor freeze on few seconds. After that numbers runs on monitor again, but stop saving in file.  
So core think that it’s still connected to linux. Netcat also doesn’t interrupt the session. But no more data saved. Sometimes during this process Core start blinking red and reboot ☹  
If i try to send data not a single bytes but byte series then all this events happen in same manner.

What does such behaviour mean? And how can i transfer more than a couple of bytes to the server?

---

<div class="post-metadata">

**Author:** ![mdma](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/mdma/32/1924_2.png) [@mdma](https://community.particle.io/u/mdma)\
**Post date:** [September 19, 2015, 11:13pm UTC](https://community.particle.io/t/tcpclient-write-in-loop-doesnt-transfer-data-after-few-kilobytes/15737/2 "2015-09-19T23:13:51Z")

</div>

Have you tried updating to the latest cc3000 service pack? [https://github.com/spark/cc3000-patch-programmer/tree/ti-patch-1.14/build](https://github.com/spark/cc3000-patch-programmer/tree/ti-patch-1.14/build)

---

<div class="post-metadata">

**Author:** ![shax](https://avatars.discourse-cdn.com/v4/letter/s/f05b48/32.png) [@shax](https://community.particle.io/u/shax)\
**Post date:** [September 21, 2015, 12:40pm UTC](https://community.particle.io/t/tcpclient-write-in-loop-doesnt-transfer-data-after-few-kilobytes/15737/3 "2015-09-21T12:40:39Z")

</div>

Thank you very much.  
I am missed this cc3000 update. It’s fix issue.
