At 09:22 AM 2/3/2003, Vaclav Ovsik wrote: >Hi, >I have written some very simple test server using apr (src included). > >I met a problem on Windoze NT (among other things): >When the receive timeout occures on a call apr_socket_recv() in the >serving thread, a call to apr_socket_accept() is also interrupted in the >main thread. Next accept on the same socket ends on "socket operation on >non-socket".
The answer is really sort of simple, but I'm still working on the resolution... There is no such thing as a blocking Win32 socket. Since Unix respects a socket timeout, irrespective of blocking/nonblocking, we use those modes appropriately. On Win32, there are no socket timeouts, and therefore no way to do timeouts on blocking sockets. Therefore the entire blocking and nonblocking magic is coded under the hood within APR. This means every call that *can* return WSAEAGAIN/WSAEWOULDBLOCK must perform it's own wait call with the timeout against whatever operation we just attempted. This is done correctly in the read/write calls, but we neglected to perform that loop within the accept call. Our bad, me culpa, I'm working on the fix. Thanks again for the report and the example code!!! Bill
