none
waitformultipleobjects (event + socket) RRS feed

  • Pregunta

  • The problem is that I must control an event and a socket status (error, write available or read available). By the moment I've to WaitForSingleObject on the event and then select on the socket so I've 2 separate timeouts, one for the event and other fot the socket. I'd like to wait for them at the same time and retrieve if any has changed, like in WaitForMultipleObjects.

    Is there any way to wait to retrieve a socket handle to use it in waitformultipleobjects or any way to waitformultipleobjects on a socket and a handle like an event?.

    Thanks.

    Example:

    SOCKET s = socket(AF_INET, SOCK_STREAM, 0);
    HANDLE h = CreateEvent(NULL, FALSE, FALSE, "sample_event");

    HANDLE hWait[2];
    hWait[0] = (HANDLE)s;
    hWait[1] = h;

    connect(s, &saddr, sizeof(sockaddr));

    WaitForMultipleObjects(2, hWait, FALSE, 2000);
    • Editado marranxo viernes, 21 de agosto de 2009 9:34
    viernes, 21 de agosto de 2009 9:22

Respuestas