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.

CC3100 Error while sending the data

I am trying to run the TP Socket demo code but I am constantly getting an error when it tries to send data to the server. I have turned off both my Firewall and my Anti-Virus. I have included yje terminal output below, ny suggestions are welcomed.

Thanks

Kas

TCP socket application - Version 1.0.0
*******************************************************************************
Device is configured in default state
Device started as STATION
Connection established w/ AP and IP is acquired
Establishing connection with TCP server
Connection with TCP server established successfully
Error while sending the data
Started TCP server

  • Hi Kas,

    Can you please check the return value of 'sl_Send()' function in failed case?

    Regards,

    Ankur

  • Hello Ankur, 

     

    I have run the code a few more times to try figure this out. In the snippet below from the main.c of tcp_socket (I added strings I can send and read) LoopCount does not seem to be used and does not show up in the variable window. As for the value of Status (the return value from sl_Send) it always appears to be '0', even with this value the code goes into the if statement [if( Status <= -1 )] resulting in a "Error while sending the data". 

    In short the return value is '0' yet the code appears to be treating it as a -1.

    while (LoopCount < NO_OF_PACKETS)
    {
    // Status = sl_Send(SockID, uBuf.BsdBuf, BUF_SIZE, 0 );
    Status = sl_Send(SockID, plotly, sizeof(plotly), 0 );
    if( Status <= -1 )
    {
    CLI_Write(" Error while sending the data \n\r");
    sl_Close(SockID);
    return -1;
    }
    LoopCount++;
    asm(" nop");
    }
    
    sl_Close(SockID);
    
    return 0;
    }

    Thanks

    Kas

  • Kas,

    'sl_Send' returning 0 is indeed an error case and indicates that the other end of the socket is closed/broken. Please confirm if the server is up and waiting for data from the SimpleLink device

    -Praneet

  • Hello Praneet, 

     

    The server is up and running, when I run the code I can see the packets arrive on the server side. I am using Hercules Socket software and I can see what I am trying to send displayed in the receive terminal on the server side.

    Even when the server is up and running and I receive all the packets I am still getting a 0 and even with the code modification it is still returning a -1 even though I have changed the if statement to be < 0. Do you have any further suggestions.

    Kas

  • Hello Praneet, 

     

    Do you have any further suggestions ?

     

    Thanks

    Kas

  • Kas,

    I'll check it internally and get back to you ASAP.

    -Praneet

  • Hi everybody,

    i have got the same behviour with SocketTest application on MAC OSX.

    To success to send data, i need to send ASCII data (put only 'A' and not  the (_u8)(idx % 10) inside the buffer.

    Then all is ok.

    Maybe some server does not like to shown not ascii data...

    Fabien

  • Hi,

    I have the same Problem and I tryed your Method, but it doesn't work, I added the code a variable and checked the return of sl_send and it is : 0

    declaration of buffer:
    union
    {
    _u8 BackBuf[2]; //buffer that send data
    _u8 BsdBuf[BUF_SIZE];
    _u32 demobuf[BUF_SIZE/4];
    } uBuf;

    part where i send data:

    uBuf.BackBuf[0] = 'c'; //uBuf.BsdBuf[1];
    uBuf.BackBuf[1] = 'b'; //uBuf.BsdBuf[2];

    Status = sl_Send(SockID, uBuf.BackBuf, sizeof(uBuf.BackBuf), 0 );
    if( Status <= 0 )
    test1 += Status;
    {
    CLI_Write(" [TCP Client] Data send Error \n\r");
    Status = sl_Close(SockID);
    ASSERT_ON_ERROR(TCP_SEND_ERROR);
    }

    I use Hercules.

    thank you

  • I found my error:

    Status = sl_Send(newSockID, uBuf.BackBuf, sizeof(uBuf.BackBuf), 0 );   instead of Status = sl_Send(SockID, uBuf.BackBuf, sizeof(uBuf.BackBuf), 0 );

    Luca