summaryrefslogtreecommitdiff
path: root/doc/docstrings/multi_fdset.rst
blob: 4f01316bac37eb9373e9dbf0fd91ef096562be13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
fdset() -> tuple of lists with active file descriptors, readable, writeable, exceptions

Returns a tuple of three lists that can be passed to the select.select() method.

Corresponds to `curl_multi_fdset`_ in libcurl. This method extracts the
file descriptor information from a CurlMulti object. The returned lists can
be used with the ``select`` module to poll for events.

Example usage::

    import pycurl
    c = pycurl.Curl()
    c.setopt(pycurl.URL, "https://curl.haxx.se")
    m = pycurl.CurlMulti()
    m.add_handle(c)
    while 1:
        ret, num_handles = m.perform()
        if ret != pycurl.E_CALL_MULTI_PERFORM: break
    while num_handles:
        apply(select.select, m.fdset() + (1,))
        while 1:
            ret, num_handles = m.perform()
            if ret != pycurl.E_CALL_MULTI_PERFORM: break

.. _curl_multi_fdset:
    https://curl.haxx.se/libcurl/c/curl_multi_fdset.html