From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10036 invoked by alias); 19 Sep 2006 18:36:22 -0000 Received: (qmail 10025 invoked by uid 22791); 19 Sep 2006 18:36:21 -0000 X-Spam-Check-By: sourceware.org Received: from mail.cruzio.com (HELO mail.cruzio.com) (63.249.95.37) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 19 Sep 2006 18:36:16 +0000 Received: from [172.100.25.3] (unknown.Level3.net [64.154.219.132] (may be forged)) by mail.cruzio.com with ESMTP id k8JIaESD083870; Tue, 19 Sep 2006 11:36:14 -0700 (PDT) Message-ID: <45103899.7070400@gnu.org> Date: Tue, 19 Sep 2006 18:36:00 -0000 From: Casey Marshall User-Agent: Thunderbird 1.5.0.7 (Macintosh/20060909) MIME-Version: 1.0 To: Jeroen Frijters CC: mauve-discuss@sourceware.org Subject: Re: New SocketChannel test that requires testing References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Mailing-List: contact mauve-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: mauve-discuss-owner@sourceware.org X-SW-Source: 2006-q3/txt/msg00030.txt.bz2 Jeroen Frijters wrote: > Casey Marshall wrote: >> Jeroen Frijters wrote: >>> Casey Marshall wrote: >>>> Maybe we are wrong for returning true for `isConnected' that >>>> early after trying to establish the connection; the test >> we're using >>>> is whether or not the socket has a remote address or not, which may >>>> not be the criteria we're interested in. >>> Yes, I believe that's incorrect. I think you can only >> transition into >>> the connected state by calling finishConnect (if connect >> was called in >>> non-blocking mode). >>> >> That's not necessarily true; on some systems, even a non-blocking call >> to connect() can succeed immediately, if you are connecting >> to the local machine. It doesn't sound right that you get this >> condition even when the server process hasn't pulled the connection >> off the queue, but that may be how it works. > > I don't think it has nothing to do with the underlying socket mechanics, > it is simply an invariant of the SocketChannel API. > Nope: "If this channel is in non-blocking mode then an invocation of this method initiates a non-blocking connection operation. If the connection is established immediately, as can happen with a local connection, then this method returns true. Otherwise this method returns false and the connection operation must later be completed by invoking the finishConnect method." [1] 1. http://java.sun.com/j2se/1.4.2/docs/api/java/nio/channels/SocketChannel.html#connect(java.net.SocketAddress)