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

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 :frowning:
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?

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

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

1 Like