This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Interruptable connect


On Thu, Jul 04, 2002 at 02:54:44PM +0200, Thomas Pfaff wrote:
> > Sure, but how will this help ? You can not look ahead if the connect will
> > be reentered or not. If the program is well written it will or close the
> > socket afterwards, but should i rely on this ?
> >
> 
> To be more precise:
> I have no problems with unclosed sockets but with a connected socket
> that shouldn't be connected.

I see.  The question is if we're able to get around that Winsock'ism.

Perhaps Winsock2 helps a bit.

This is just brainstorming, I have no idea if that works:

When connect is called, create a duplicate of the socket first,
before actually connecting, using the WSADuplicateSocket call.
This should give you a structure describing the socket in exactly
the state before the ::connect call.  Now for the cases:

- Normal connect, success, erase the duplicate.
- Normal connect, failure, ditto.
- Interrupt, close original socket and recreate it from the duplicate
  using WSASocket.

Would that work???

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]