cURL / Mailing Lists / curl-library / Single Mail


select error

From: Tom Jerry <>
Date: Tue, 10 Oct 2006 10:55:50 +0200

I'm using libcurl 7.15.5 under Win2k.
I'm using the multi interface, and have a separate thread for the multi
Whenever I "select" and there are no easy handles added to the multi handle
(for example, when the application starts and there are still no http
requests to send or when all requests are finished), I get an error (rc is
-1) and WSAGetLastError() returns 10022.

According to MSDN:
WSAEINVAL (10022) *Invalid argument*.Some invalid argument was supplied (for
example, specifying an invalid level to the *setsockopt* function). In some
instances, it also refers to the current state of the socket???for instance,
calling *accept*<>on
a socket that is not listening.
Does it seems to you like a normal behaviour of select or is there something
wrong with my code?

Here is a portion of my code:


        maxfd = 0;

        /* set a suitable timeout to play around with */
        timeout.tv_sec = 1;
        timeout.tv_usec = 0;

        /* get file descriptors from the transfers */
        /* we start some action by calling perform right away */
            curl_multi_perform(m_multi_handle, &still_running));
        curl_multi_fdset(m_multi_handle, &fdread, &fdwrite, &fdexcep,

        rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);

        switch(rc) {
        case -1:
            LogMessageEx (EVENTLOG_WARNING_TYPE, CAT_IP_MC, 0,
                "CHttpPollingThread::main() : select error,
WSAGetLastError=%d !!!",

Received on 2006-10-10