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.

CC3235S: HTTP client API response timeout

Part Number: CC3235S
Other Parts Discussed in Thread: SYSCONFIG

Hi,

I am using HTTP client example program from TI Simplelink SDK. I am downloading 4MB file size from HTTP server. This data is downloaded in chunk of 16KB. Hence API - HTTPClient_readResponseBody(httpClientHandle, data, sizeof(data),&moreDataFlag);  is called repeatedly.

However, if network is disconnected then I observe that my program get stuck in this API for 5 mins. I think this is default timeout. I want to reduce this timeout but can;t find how to do this? Can you please help me here on how to set this timeout to different value?

Thanks,

Pradeep

  • What error code are you getting?

    Do you get async disconnection event in SimplelinkWlanEventHandler? just before the 5 minutes?

    Basically the http waits on receive socket without any timeout.

    You can update httpclient.c (e.g. in getChunkedData just befroe calling SlNetSock_recv) so it will configure the timeout using socket option.

    Once you will do this - you'll need to re-build the httpclient library and then the application.

        - SLNETSOCK_OPSOCK_RCV_TIMEO:
        \code
            struct SlNetSock_Timeval_t timeVal;
            timeVal.tv_sec =  1; // Seconds
            timeVal.tv_usec = 0; // Microseconds. 10000 microseconds resolution
            SlNetSock_setOpt(SockID, SLNETSOCK_LVL_SOCKET, SLNETSOCK_OPSOCK_RCV_TIMEO, (uint8_t *)&timeVal, sizeof(timeVal)); // Enable receive timeout
        \endcode
        <br>
    

  • No error code. The return value is 0.

    Yes, I get async disconnection event in SimplelinkWlanEventHandler as soon as network is disconnected. But API - HTTPClient_readResponseBody() get stuck and does not come out for 5 minutes. After 5 minutes it returns value as 0.

    How to build httpclient library? Is there any documentation?

  • See <SDK-ROOT>/docs/simplelink_mcu_sdk/Quick_Start_Guide.html (check the "build-core-libs" section).

    You should refer to the makefile under "<SDK-ROOT>/source/ti/net/" - that will build all the network services.

  • I tried building library and getting this error:

    D:\ti\simplelink_cc32xx_sdk_4_10_00_07\source\ti\net>d:\ti\xdctools_3_61_00_16_core\gmake.exe
    building packages ...
    xdctools_3_61_00_16_core\gmake.exe: *** [d:/ti/xdctools_3_61_00_16_core\packages\xdc\bld\xdc_top.mak:374: _startime] Error 127
    gmake: *** [makefile:49: all] Error 2

    I have already updated paths in imports.mak for tools path as below:

    XDC_INSTALL_DIR ?= d:/ti/xdctools_3_61_00_16_core
    SYSCONFIG_TOOL ?= d:/ti/ccs1120/ccs/utils/sysconfig_1.12.0/sysconfig_cli.bat

    FREERTOS_INSTALL_DIR ?= D:/Simplelink/FreeRTOSv202112.00

    CCS_ARMCOMPILER ?= d:/ti/ccs1120/ccs/tools/compiler/ti-cgt-arm_20.2.0.LTS
    GCC_ARMCOMPILER ?= c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-9-2019-q4-major-win32
    IAR_ARMCOMPILER ?= c:/Program Files (x86)/IAR Systems/Embedded Workbench 8.4/arm

    Please suggest.

  • I'm not sure what is the issue (i'm using the latest SDK, CCS and XDC tools).

    Another option is that you copy the httpclient.c to your applicatiobn project and change (&build) it there. Once built the object file will override the content from the library. 

    (note that you may need to update the include path of the project).