From owner-freebsd-current@FreeBSD.ORG Fri May 6 04:34:17 2005 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 53AA216A4CE for ; Fri, 6 May 2005 04:34:17 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id D1B8143D1F for ; Fri, 6 May 2005 04:34:16 +0000 (GMT) (envelope-from d4rkstorm@gmail.com) Received: by rproxy.gmail.com with SMTP id j1so386318rnf for ; Thu, 05 May 2005 21:34:16 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=lU/FjyIo5ZlojqrTq9rGaHqgd4Dc59vnBpVVxJL9lZlCcRoQRD9E7ascL+gBGHxtxFV9phJtlXYUqbSmbY2b1gEVC8/IFYRsFNFD/zDyickeo5SPG6PpJH4PhYgyzD1k+TH6YUj1ECvbEqKyIm6ltFzSDMCU5OQmDfrlAOvCOrs= Received: by 10.38.150.57 with SMTP id x57mr946318rnd; Thu, 05 May 2005 21:34:16 -0700 (PDT) Received: by 10.38.101.1 with HTTP; Thu, 5 May 2005 21:34:16 -0700 (PDT) Message-ID: <245f0df10505052134124cc6b7@mail.gmail.com> Date: Fri, 6 May 2005 14:34:16 +1000 From: "anon:*:anon" To: freebsd-current@freebsd.org In-Reply-To: <20050506030841.GL51983@linwhf.opal.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20050506023318.GK51983@linwhf.opal.com> <20050505193739.Y36831@thought.holo.org> <20050506030841.GL51983@linwhf.opal.com> Subject: Re: async connect problem X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: "anon:*:anon" List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 May 2005 04:34:17 -0000 Subsequent code to check the socket's status, something like: int n; socklen_t intsize =3D sizeof(int); getsockopt(f, SOL_SOCKET, SO_ERROR, (void*)&n, &intsize); if (n) ... which works (with suitable cast adjustments) on Solaris, Linux, Darwin, and yes, even on Windows, doesn't work here. inline bool sockreq() { return bSocketsRunning; } it could be a simple script, or it could become a socket array of nightmares.. but it is no oubt a god idea to always check the sockets. On 5/6/05, J.R. Oldroyd wrote: > On May 05, 19:39, Brian Buchanan wrote: > > On Thu, 5 May 2005, J.R. Oldroyd wrote: > > > > >Isn't our behaviour wrong... > > > > > >On 6-current, the program below prints: > > > connect: Connection refused > > > > > >Shouldn't it print: > > > connect: Operation now in progress > > > > No, that's the correct behavior. The system was able to satisfy your > > request without blocking because you were attempting a connection to th= e > > loopback, so connect() returned immediately with errno =3D=3D ECONNREFU= SED. > > > > - Brian >=20 > You are correct, it does return EINPROGRESS when using a non-loopback > address. >=20 > Perhaps I should ask a different question. >=20 > Subsequent code to check the socket's status, something like: >=20 > int n; > socklen_t intsize =3D sizeof(int); >=20 > getsockopt(f, SOL_SOCKET, SO_ERROR, (void*)&n, &intsize); > if (n) ... >=20 > which works (with suitable cast adjustments) on Solaris, Linux, > Darwin, and yes, even on Windows, doesn't work here. >=20 > I have an alternative test that uses getpeername(), but I'm surprised > at the difference in behavior. >=20 > -jr > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org= " >=20 --=20 ------------------------------------------ Signature Here ------------------------------------------