From owner-freebsd-current@FreeBSD.ORG Fri May 6 02:34:45 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 39A4116A4CE for ; Fri, 6 May 2005 02:34:45 +0000 (GMT) Received: from smtp.vzavenue.net (smtp.vzavenue.net [66.171.59.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id B804843DA9 for ; Fri, 6 May 2005 02:34:44 +0000 (GMT) (envelope-from jr@opal.com) Received: from linwhf.opal.com (112.79.171.66.subscriber.vzavenue.net [66.171.79.112]) by smtp.vzavenue.net (MOS 3.4.8-GR) with ESMTP id CEF17207; Thu, 5 May 2005 22:33:18 -0400 (EDT) Received: from linwhf.opal.com (localhost [127.0.0.1]) by linwhf.opal.com (8.13.3/8.13.1) with ESMTP id j462XIre037007 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO) for ; Thu, 5 May 2005 22:33:18 -0400 (EDT) (envelope-from jr@linwhf.opal.com) Received: (from jr@localhost) by linwhf.opal.com (8.13.3/8.13.1/Submit) id j462XIol037006 for freebsd-current@freebsd.org; Thu, 5 May 2005 22:33:18 -0400 (EDT) (envelope-from jr) Date: Thu, 5 May 2005 22:33:18 -0400 From: "J.R. Oldroyd" To: freebsd-current@freebsd.org Message-ID: <20050506023318.GK51983@linwhf.opal.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.1i X-Junkmail-Status: score=0/50, host=smtp.vzavenue.net Subject: async connect problem X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list 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 02:34:45 -0000 Isn't our behaviour wrong... On 6-current, the program below prints: connect: Connection refused Shouldn't it print: connect: Operation now in progress Hint: it does on Linux. -jr ------ #include #include #include #include #include #include main() { int s; int f; struct sockaddr_in addr; addr.sin_family = AF_INET; addr.sin_port = htons(54321); /* port with nothing on it */ addr.sin_addr.s_addr = inet_addr("127.0.0.1"); s = socket(PF_INET, SOCK_STREAM, 0); if (s < 0) { perror("socket"); exit(1); } f = fcntl(s, F_GETFL, 0); if (f < 0) { perror("fcntl F_GETFL"); exit(1); } f |= O_NONBLOCK; if (fcntl(s, F_SETFL, f) < 0) { perror("fcntl F_SETFL"); exit(1); } if (connect(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) { perror("connect"); exit(1); } exit(0); }