delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2003/02/25/07:12:57

Mailing-List: contact cygwin-developers-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT cygwin DOT com>
List-Help: <mailto:cygwin-developers-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-developers-owner AT cygwin DOT com
Delivered-To: mailing list cygwin-developers AT cygwin DOT com
Date: Tue, 25 Feb 2003 13:12:51 +0100
From: Corinna Vinschen <vinschen AT redhat DOT com>
To: Thomas Pfaff <tpfaff AT gmx DOT net>
Cc: cygwin-developers AT cygwin DOT com
Subject: Re: Interruptable connect
Message-ID: <20030225121251.GF8853@cygbert.vinschen.de>
Reply-To: cygwin-developers AT cygwin DOT com
Mail-Followup-To: Thomas Pfaff <tpfaff AT gmx DOT net>,
cygwin-developers AT cygwin DOT com
References: <Pine DOT WNT DOT 4 DOT 44 DOT 0207041318550 DOT 105-100000 AT algeria DOT intern DOT net>
Mime-Version: 1.0
In-Reply-To: <Pine.WNT.4.44.0207041318550.105-100000@algeria.intern.net>
User-Agent: Mutt/1.4i

Hi Thomas,

could we discuss this issue again?  Do we have any problem to get all
required information on a socket which would keep us from closing it
and reopen a new one in the same (but unconnected) state?

Corinna

On Thu, Jul 04, 2002 at 01:54:33PM +0200, Thomas Pfaff wrote:
> 
> I am trying to get an interruptable connect and i have some difficulties.
> 
> The main problem is that it seems to be impossible to cancel a nonblocking
> connect other than closing the socket. I already thought about closing the
> socket and replacing it with a new one, but this requires that all
> sockoptions and states have to be restored for the new one execpt the
> pending connect.
> 
> Another possibility is to set errno to EINTR, return and let the
> connect keep going.
> The app can now react in different ways :
> 
> The signal handler terminates the program.
> Perfect.
> 
> The program checks for the error and close the socket.
> Good.
> 
> connect is called in a loop like
> do {
>   res = connect(...);
>   if (!res)
>     break;
> } while(errno==EINTR);
> Now the program returns to the connect function, the real connect returns
> WSAEALREADY or WSAEISCONN, it can be checked that the connect was
> interrupted and it can be continued.
> No big deal.
> 
> The error is ignored and the socket is not closed:
> Now there are 2 possibilies.
> 
> a. The connect fails.
> No problem.
> 
> b. The connect succeds. Now exists an orphaned connection that can block
> the partner.
> Sigh.
> 
> Any suggestions ?
> 
> Thomas
> 
> 
> 

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019