delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/02/20/02:52:26

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Wed, 20 Feb 2013 08:51:43 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: non-blocking accept() can hang.
Message-ID: <20130220075143.GI23688@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <CANjopZGmp+xaUg1Sn2FTmb77igMk8R=Lp9yBWyeDtDj3RP5R=g AT mail DOT gmail DOT com> <loom DOT 20130205T082932-242 AT post DOT gmane DOT org> <CANjopZHH2kv0s0pitt0beFiC=tsP5bOsSBJ8TBhSWnSD-iP7fg AT mail DOT gmail DOT com> <loom DOT 20130206T131835-535 AT post DOT gmane DOT org> <CANjopZHhRZts4nOm6h19h2xY02=7L5WNuVypDkLqo2cojUG2zA AT mail DOT gmail DOT com> <5114A38B DOT 6060201 AT gmail DOT com> <CANjopZExQ_qZc90jOi9qEZ+mvw4o87hOw_fAa8JhEDOfV+yQJA AT mail DOT gmail DOT com> <20130219144600 DOT GE23688 AT calimero DOT vinschen DOT de> <CANjopZHYnCJfhT7_8fSijiukf5gcpGdW3bOU610Uy_kULTZNCg AT mail DOT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <CANjopZHYnCJfhT7_8fSijiukf5gcpGdW3bOU610Uy_kULTZNCg@mail.gmail.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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 20 07:16, Tanaka Akira wrote:
> 2013/2/19 Corinna Vinschen
> >
> > 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.
> 
> Thank you for the information.
> I'll use threads.

The most simple way to get a connected local socket is to use the
socketpair function, btw.


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

- Raw text -


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