---------- Forwarded message ----------
From: huancong deng <[email protected]>
Date: Fri, Nov 2, 2012 at 7:17 PM
Subject: How can i get socket fd from multi_curl ?
To: [email protected]


here is my code , I want to get the socket fd from curl_multi_fdset
function, but is it right ? who can tell me about this??? thanks a lot.
====================================================================================================
   map<int, uint32_t> mapFDEvents;
   res = curl_multi_perform(args->multi_curl, &running_handles);
   curl_multi_fdset(args->multi_curl, &fdread, &fdwrite, &fdexcep, &maxfd);
    g_sInterface.log_write(3, "AIOCURL:maxfd:%u", maxfd);
    for ( int i = 0;i < __FD_SETSIZE / __NFDBITS;i++ ) {
        for ( int j = 0;j < __NFDBITS;j++ ) {
            int fd = i * __NFDBITS + j;
            if ( __FDS_BITS(&fdread)[i] & (1 << j) ) {
                mapFDEvents[fd] = EPOLLIN;
            }
            if ( __FDS_BITS(&fdwrite)[i] & (1 << j) ) {
                if ( mapFDEvents.find(fd) == mapFDEvents.end() ) {
                    mapFDEvents[fd] = EPOLLOUT;
                }
                else {
                    mapFDEvents[fd] |= EPOLLOUT;
                }
            }
        }
    }
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to