[RPCRT4] TCP server support (try 2 resend)
Alexandre Julliard
julliard at winehq.org
Tue Oct 17 08:38:15 CDT 2006
"Damjan Jovanovic" <damjan.jov at gmail.com> writes:
> + while (!tcpc->quit)
> + {
> + FD_ZERO(&readableSet);
> + FD_SET(tcpc->sock, &readableSet);
> + timeout.tv_sec = 1;
> + timeout.tv_usec = 0;
> + ret = select(tcpc->sock + 1, &readableSet, NULL, NULL, &timeout);
> + if (ret < 0)
> + ERR("select failed with error %d\n", ret);
> + else
> + {
> + if (FD_ISSET(tcpc->sock, &readableSet))
> + {
> + SetEvent(tcpc->onEventAvailable);
> + WaitForSingleObject(tcpc->onEventHandled, INFINITE);
> + ResetEvent(tcpc->onEventHandled);
> + }
> + }
It would be cleaner to use poll() instead of select(). Also you
probably want to use auto-reset events, that would reduce the number
of server calls you have to make.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list