Annotation of embedaddon/curl/docs/libcurl/curl_multi_timeout.3, revision 1.1

1.1     ! misho       1: .\" **************************************************************************
        !             2: .\" *                                  _   _ ____  _
        !             3: .\" *  Project                     ___| | | |  _ \| |
        !             4: .\" *                             / __| | | | |_) | |
        !             5: .\" *                            | (__| |_| |  _ <| |___
        !             6: .\" *                             \___|\___/|_| \_\_____|
        !             7: .\" *
        !             8: .\" * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
        !             9: .\" *
        !            10: .\" * This software is licensed as described in the file COPYING, which
        !            11: .\" * you should have received as part of this distribution. The terms
        !            12: .\" * are also available at https://curl.haxx.se/docs/copyright.html.
        !            13: .\" *
        !            14: .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
        !            15: .\" * copies of the Software, and permit persons to whom the Software is
        !            16: .\" * furnished to do so, under the terms of the COPYING file.
        !            17: .\" *
        !            18: .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
        !            19: .\" * KIND, either express or implied.
        !            20: .\" *
        !            21: .\" **************************************************************************
        !            22: .TH curl_multi_timeout 3 "March 23, 2020" "libcurl 7.70.0" "libcurl Manual"
        !            23: 
        !            24: .SH NAME
        !            25: curl_multi_timeout \- how long to wait for action before proceeding
        !            26: .SH SYNOPSIS
        !            27: #include <curl/curl.h>
        !            28: 
        !            29: CURLMcode curl_multi_timeout(CURLM *multi_handle, long *timeout);
        !            30: .SH DESCRIPTION
        !            31: 
        !            32: An application using the libcurl multi interface should call
        !            33: \fIcurl_multi_timeout(3)\fP to figure out how long it should wait for socket
        !            34: actions \- at most \- before proceeding.
        !            35: 
        !            36: Proceeding means either doing the socket-style timeout action: call the
        !            37: \fIcurl_multi_socket_action(3)\fP function with the \fBsockfd\fP argument set
        !            38: to CURL_SOCKET_TIMEOUT, or call \fIcurl_multi_perform(3)\fP if you're using
        !            39: the simpler and older multi interface approach.
        !            40: 
        !            41: The timeout value returned in the long \fBtimeout\fP points to, is in number
        !            42: of milliseconds at this very moment. If 0, it means you should proceed
        !            43: immediately without waiting for anything. If it returns -1, there's no timeout
        !            44: at all set.
        !            45: 
        !            46: An application that uses the multi_socket API SHOULD NOT use this function, but
        !            47: SHOULD instead use \fIcurl_multi_setopt(3)\fP and its
        !            48: \fPCURLMOPT_TIMERFUNCTION\fP option for proper and desired behavior.
        !            49: 
        !            50: Note: if libcurl returns a -1 timeout here, it just means that libcurl
        !            51: currently has no stored timeout value. You must not wait too long (more than a
        !            52: few seconds perhaps) before you call curl_multi_perform() again.
        !            53: .SH EXAMPLE
        !            54: .nf
        !            55: struct timeval timeout;
        !            56: long timeo;
        !            57: 
        !            58: curl_multi_timeout(multi_handle, &timeo);
        !            59: if(timeo < 0)
        !            60:   /* no set timeout, use a default */
        !            61:   timeo = 980;
        !            62: 
        !            63: timeout.tv_sec = timeo / 1000;
        !            64: timeout.tv_usec = (timeo % 1000) * 1000;
        !            65: 
        !            66: /* wait for activities no longer than the set timeout */
        !            67: select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
        !            68: .fi
        !            69: .SH "RETURN VALUE"
        !            70: The standard CURLMcode for multi interface error codes.
        !            71: .SH "TYPICAL USAGE"
        !            72: Call \fIcurl_multi_timeout(3)\fP, then wait for action on the sockets. You
        !            73: figure out which sockets to wait for by calling \fIcurl_multi_fdset(3)\fP or
        !            74: by a previous call to \fIcurl_multi_socket(3)\fP.
        !            75: .SH AVAILABILITY
        !            76: This function was added in libcurl 7.15.4.
        !            77: .SH "SEE ALSO"
        !            78: .BR curl_multi_fdset "(3), " curl_multi_info_read "(3), "
        !            79: .BR curl_multi_socket "(3), " curl_multi_setopt "(3) "

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>