X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Tue, 19 Feb 2013 15:46:00 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: non-blocking accept() can hang. Message-ID: <20130219144600.GE23688@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <5114A38B DOT 6060201 AT gmail DOT com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Feb 12 10:52, Tanaka Akira wrote: > 2013/2/8 marco atzeri : > > > you can also test by yourself > > http://cygwin.com/snapshots/ > > I see. I re-tested after replacing /bin/cygwin1.dll. > > Unfortunately, the program still block. > (Good news is that ^C is effective. > I don't need to kill the process using Windows task manager.) Sorry for the late response, but I'm pretty busy with porting Cygwin to 64 bit right now. I debugged your example code, and it can't work on Cygwin. The problem is that accept/connect on AF_LOCAL sockets performs a handshake operation to make sure that the other side of the socket is a Cygwin process as well, and to propagate credential information between client and listener. The way it's implemented right now requires that both sides of the socket are responsive. That's a safe thing for the accept call here, but since there's neither a blocking connect, nor a select or poll call waiting on the connecting side of the socket, nothing goes forward. To get this code working, you have to use either AF_INET or AF_INET6 sockets, or you have to start a thread calling select or poll, so there's an active function call which allows to perform the handshake from the connecting side. HTH, Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple