This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TCP send data failed or stack overflow? problem

Other Parts Discussed in Thread: CC3200, CC3100

Hello,

I have been struggling with one problem lately. I have created my HTTP server. I serve files ~800kB and in (30-50%) cases I do not get full response from server. I believe it is related to non blocking socket used in HTTP server. It looks like CC3200 do not flush all data to socket on close (or maybe in the middle of write).

I decided to try to use blocking socket but I ended with random 0xA5A5A5A5 errors received from socket. I have read that it is related to stack overflow so I increased HTTP stack, then other tasks stack and still got errors. Lately I have changed stack of Simplelink task and errors stop occurring so often, but still once per 15-20 min I got one (my socket i blocked for 10ms).

Is it possible to fix the flushing problem and work with non blocking socket?

I use 1.1 SDK with service pack compatible with it (1.0.0.10.0).

Thanks,

Piotr M.

  • Hello Piotr!

    If possible, I recommend working with the latest SDK and service pack (SDK v1.2.0 and servicepack_v1.0.1.6-2.7.0.0).

    Best Regards,
    Ben
  • Hello,

    I did it and still have the problem (I use non blocking method). I have downloaded the file 33 times correctly and the 34th was corrupted. Files have the same and they are slightly different (i created patch using bfdiff tool and it has 195 bytes when original file has 823kB).

    Accessing simple link from two tasks should not be a problem right?

    Not sure what to do now.

    Thanks,

    Piotr

  • Hi Piotr,

    I use own http server with CC3200 (similar network hardware with CC3100) and I did not remember similar issue.

    Few hints/tips:

    - Are you able to check you what is going on by sniffer (wireshart)?
    - It is triggered any callback handler (socket, general) in case of issue?
    - Do you have small sleep(s) inside you task which are working with non blocking sockets?
    - Do you properly work SL_EAGAIN (-11) error codes when non blocking sockets are used?
    - How looks architecture of your http server (how many client sockets)?

    It is not a problem work with SL API calls from multiple tasks. But my suggestion in this case is use same priorities for this tasks.

    Jan
  • Hello Jan,

    1. I could.
    2. No.
    3. Yes - 10 ms in loop and 5 ms before close.
    4. Yes.
    5. 2 sockets - 1 for regular HTTP calls and one reserved for keep alive WebSockets calls.

    I switched to blocking (10ms) sockets with the new SDK and do not have (I believe, I have left device running for 16h+) stack overflow issues. I will keep testing this solution. Please do not close this topic for couple of days. When I run into this trouble again I will let you know.

    Thanks,

    PM

  • Hello,

    I was managed to sniff communication. I see TCP packet with reset flag set to 1. I have googled and it looks like it is reason for receiving packet from closed socked.

    ----
    # Packet 3834
    - 3835
    - 8.847908
    - 192.168.1.2
    - 192.168.1.1
    - TCP
    - 54
    - 50743 → 80 [RST, ACK] Seq=98 Ack=844185 Win=0 Len=0
  • Ok, I still have the problem with stuck overflow. Without blocking socket I see errors related with corrupted data send by server (socket is closed before all data reach the client. With blocking socket I see stack overflow.

    I have increased stack of my tasks related with HTTP server and I still have this problem.