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.

cc3200 sl_Send hangs when last byte is Zero

The following code hangs my open socket connection:

unsigned char png[3];
png[0] = 0xC0;
png[1] = 0x0;
lRetVal = sl_Send(mySock, png, 2, 0);


If I set png[1] to other than 0 it works fine.

Can someone verify or describe a possible solution?

Thanks, Tom

  • Hi Tom,

    Are you using transceiver mode socket or TCP socket?

    Regards,
    Ankur
  • Hi Ankur,

    I believe I am using TCP socket, since I open it like this:

    mySock = sl_Socket(SL_AF_INET, SL_SOCK_STREAM, 0);
    if( mySock < 0 ) {
    DBG_PRINT("mqttTask: slSocket failed. %d\r\n", mySock);
    }

    This is running as it's own task for mqtt processing and all works fine, until I send the 2 byte packet with a Zero at the end, then the socket hangs at the next time I do sl_Recv();

    UPDATE:
    it works if I send MQTTSerialize_disconnect(); which is (0xe0, 0x0)  which closes the connection, but expected behavior...
    when I send MQTTSerialize_pingreq(); which is (0xc0, 0x0) it hangs at sl_recv and I never get PINGRESP from server

    So, the problem may be related to the 0xc0 byte??

    UPDATE 2:

    Apparently it is sl_Recv issue, this hangs my socket:

    sl_Recv(mySock, buf, count, 0)  where count = 0



    Thanks, Tom

  • Hi Tom,

    Thanks for the update.

    Calling 'sl_Recv()' with zero length is considered a invalid use case and we have check in the driver for the same which is leading to issue you are seeing.

    Regards,
    Ankur
  • Hi Tom,

    I am closing this thread, if the issue still exists please open a new thread and add a link to this one for reference.

    Regards,
    Ankur