httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Stoddard" <stodd...@raleigh.ibm.com>
Subject Re: Is it possible to "unbind" a socket?
Date Thu, 11 May 2000 20:28:29 GMT
>> Specifically a Winsock2 socket?

>> Now my question...
>> I'd like to recycle the socket explicitly with system calls rather than relying on
>> TransmitFile to do it for me.  I can use shutdown on the socket,  but how can I
"unbind"
>> it?

> Shutdown(socket, how) and then closesocket(socket)?

shutdown(socket,how) works fine. I don't want to close the socket. I want to put the
socket back into the same state as a socket created with the socket() call. TransmitFile()
has  magic to do this. It has a couple of flags that cause the socket to be disconnected
then unbound, but -not- closed. You can then pass this exact same socket back to AcceptEx
and it works.  I would like to be able to replicate this function in cases where
TransmitFile is not used.

Why?
Reusing the socket gives a substantial performance boost serving static pages as compared
to creating a new accept socket on each call. I can serve roughly 675 non-keep alive
requests per second w/o socket reuse and 1050 request-per-second using accept socket reuse
(~55% improvement). Telling TransmitFile to do this magic results in the connection being
closed, which is a problem for keep-alive connections.  There is no way of telling, in the
general case, when you need to set the flags to tell TransmitFile to do its magic on a
keep-alive connection. Most keep-alive connections timeout on the read when no data comes
in. I'd like to be able to explicitly recycle these sockets, rather than relying on
TransmitFile to do it for me.

I bet there is a undocumented MS call to do this and I've tried to find it w/o success.

Bill



Mime
View raw message