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.

RTOS: How to decrease the Timeout in the NDK

Tool/software: TI-RTOS

Hi 

Whenever I run the HTTP Client, I face timeout issue in few packet and it takes to much. I have reduced the number of the re-transmit packets from 12 to 3 in the tcptime.c.  But still timeout is very high. It took nearly 20 seconds for one timeout to expire. How can I reduce the timeout time in NDK 

  • Fehan,

    We are investigating the timeout configuration settings.

    Would you please share the code you changed in tcptime.c to reduce the re-transmit packet count.

    Thank you,
    ~Ramsey

  • Fehan,

    In the NDK, there is a hard-coded timeout of 10 seconds in httpClientProcess(). You would have to modify this file directly.

    <NDK INSTALL>/packages/ti/ndk/nettools/http/httpclie.c
    
    /* Configure our socket timeout to be 10 seconds */
    to.tv_sec  = 10;
    to.tv_usec = 0;
    rc = setsockopt( Sock, SOL_SOCKET, SO_SNDTIMEO, &to, sizeof( to ) );
    

    If you are using Network Services, there is a timeout parameter to HTTPCli_connect() that is used with the receive socket.

    <NS INSTALL>/packages/ti/net/http/httpcli.h
    
    typedef struct HTTPCli_Params {
    
        int timeout;
        /*!< Timeout value (in seconds) for socket. Set 0 for default value */
    } HTTPCli_Params;
    
    
    extern int HTTPCli_connect(HTTPCli_Handle cli, const struct sockaddr *addr,
            int flags, const HTTPCli_Params *params);
    

    I hope this help.

    ~Ramsey