components/webclient/src/webclient.c
int webclient_set_timeout(struct webclient_session *session, int millisecond)
{
    struct timeval timeout;

    if (!session)
    {
        return WEBCLIENT_ERROR;
    }

    timeout.tv_sec = millisecond / 1000;
    timeout.tv_usec = (millisecond % 1000) * 1000;

    /* set recv timeout option */
    setsockopt(session->socket, SOL_SOCKET, SO_RCVTIMEO, (void *)&timeout, sizeof(timeout));
    setsockopt(session->socket, SOL_SOCKET, SO_SNDTIMEO, (void *)&timeout, sizeof(timeout));

    return 0;
}
/**
 * set receive and send data timeout.
 *
 * @param session http session
 * @param millisecond timeout millisecond
 *
 * @return 0: set timeout success
 */
set receive and send data timeout.
@param session http session
@param millisecond timeout millisecond

@return 0: set timeout success
set receive and send data timeout . @param session http session @param millisecond timeout millisecond @return 0 : set timeout success
int webclient_set_timeout(struct webclient_session *session, int millisecond)
{
    struct timeval timeout;
    if (!session)
    {
        return WEBCLIENT_ERROR;
    }
    timeout.tv_sec = millisecond / 1000;
    timeout.tv_usec = (millisecond % 1000) * 1000;
    setsockopt(session->socket, SOL_SOCKET, SO_RCVTIMEO, (void *)&timeout, sizeof(timeout));
    setsockopt(session->socket, SOL_SOCKET, SO_SNDTIMEO, (void *)&timeout, sizeof(timeout));
    return 0;
}
int webclient_set_timeout ( struct webclient_session * session , int millisecond ) { struct timeval timeout ; if ( ! session ) { return WEBCLIENT_ERROR ; } timeout . tv_sec = millisecond / 1000 ; timeout . tv_usec = ( millisecond % 1000 ) * 1000 ; setsockopt ( session -> socket , SOL_SOCKET , SO_RCVTIMEO , ( void * ) & timeout , sizeof ( timeout ) ) ; setsockopt ( session -> socket , SOL_SOCKET , SO_SNDTIMEO , ( void * ) & timeout , sizeof ( timeout ) ) ; return 0 ; }
set receive and send data timeout.
set receive and send data timeout .
/* set recv timeout option */