delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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 |
Message-ID: | <08ce01c2134f$7e2a4a00$6132bc3e@BABEL> |
From: | "Conrad Scott" <Conrad DOT Scott AT dsl DOT pipex DOT com> |
To: | <cygwin AT cygwin DOT com> |
References: | <007f01c21348$72149600$5a6d3850 AT piggy> |
Subject: | Re: Cygwin && TCP && O_NONBLOCK |
Date: | Fri, 14 Jun 2002 03:59:25 +0100 |
MIME-Version: | 1.0 |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-MimeOLE: | Produced By Microsoft MimeOLE V6.00.2600.0000 |
"Roderick Groesbeek" <rgroesb AT triple-it DOT nl> wrote: > Situation: > ======= > - 1 NON_BLOCKING tcp socket > - First connect() gives EINPROGRESS > - Second connect() gives: > * On Linux: nResult == 0 > * On Cygwin: nResult == -1 && errno == EISCONN > > > Question: > ======= > Which behaviour is right? > Where could I check the specifications for the implementations? According to the (current?) Open Group spec for connect(2): > If the connection cannot be established immediately and > O_NONBLOCK is set for the file descriptor for the socket, > connect() shall fail and set errno to [EINPROGRESS], > but the connection request shall not be aborted, > and the connection shall be established asynchronously. > Subsequent calls to connect() for the same socket, > before the connection is established, shall fail > and set errno to [EALREADY]. > > When the connection has been established asynchronously, > select() and poll() shall indicate that the file descriptor > for the socket is ready for writing. So I assume you call connect(2) once then wait for select(2) or poll(2) to give you a writable status, which they do once the connection eventually succeeds or fails (this is mentioned in their respective man pages). So it looks like Linux is wrong and cygwin is right. // Conrad -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |