httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <>
Subject RE: Is it possible to "unbind" a socket?
Date Wed, 10 May 2000 23:04:47 GMT
What about creating a 'template' socket, with all the appropriate
flags, and using duplicatesocket to create the replacements?

There was some mumbling about it in...

Perhaps this applies

That's just about all she wrote


> -----Original Message-----
> From: Bill Stoddard []
> Sent: Wednesday, May 10, 2000 5:22 PM
> To:
> Subject: Is it possible to "unbind" a socket?
> 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

View raw message