httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Stoddard" <stodd...@raleigh.ibm.com>
Subject Is it possible to "unbind" a socket?
Date Wed, 10 May 2000 22:22:02 GMT
Specifically a Winsock2 socket?

Background...
AcceptEx requires both an accept socket and a listen socket in its argument list.  (in
contrast to the posix accept() which requires a listen socket and it returns an accept
socket). AcceptEx binds the accept socket to the ip address under the covers.
TransmitFile() has a nice feature that allows you to pass in a set of flags
(TF_REUSE_SOCKET and TF_DISCONNECT) that will leave the accept socket in a disconnected
and unbound state after the file is sent.  This 'recycled' accept socket can then be
passed back into the AcceptEx. Reusing the accept socket in this way (rather than creating
a new accept socket each time around) is a hugh performance win.

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? I've tried setsockopt SO_REUSEADDR on the socket before shutdown, after shutdown and
before the initial call to AcceptEx (using the virgin socket) w/o success.  I've even
tried issuing TransmitFile will NULL file and data pointers (which is legal according to
the MSDN) w/o success. Fishing for ideas here...


________________________________________________
Bill Stoddard stoddard@raleigh.ibm.com


Mime
View raw message