From owner-freebsd-net@FreeBSD.ORG Wed Oct 22 20:06:08 2003 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5E28F16A4BF for ; Wed, 22 Oct 2003 20:06:08 -0700 (PDT) Received: from mag.barnet.com.au (mag.barnet.com.au [218.185.88.3]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3138543F85 for ; Wed, 22 Oct 2003 20:06:05 -0700 (PDT) (envelope-from edwin@mavetju.org) Received: from extmail.barnet.com.au (tim.direct.int.barnet.com.au [10.10.10.2]) by mag.barnet.com.au (Postfix) with ESMTP id 7C99620E3; Thu, 23 Oct 2003 13:06:03 +1000 (EST) X-Viruscan-Id: <3F97459B00013F0F01B29E8C@VIRUSCAN-127.0.0.1> Received: from extmail-auth.barnet.com.au (localhost [127.0.0.1]) by extmail.barnet.com.au (Postfix) with ESMTP id F355F1F24; Thu, 23 Oct 2003 13:06:02 +1000 (EST) Received: from k7.mavetju (p61-max1.syd.ihug.com.au [203.173.155.61]) by extmail-auth.barnet.com.au (Postfix) with ESMTP id 4005F1F22; Thu, 23 Oct 2003 13:06:02 +1000 (EST) Received: by k7.mavetju (Postfix, from userid 1001) id CA6386A7101; Thu, 23 Oct 2003 13:06:00 +1000 (EST) Date: Thu, 23 Oct 2003 13:06:00 +1000 From: Edwin Groothuis To: Lev Walkin Message-ID: <20031023030600.GX59349@k7.mavetju> References: <20031023023146.GA34131@k7.mavetju> <3F974296.9040304@netli.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3F974296.9040304@netli.com> User-Agent: Mutt/1.4.1i cc: freebsd-net@freebsd.org Subject: Re: UDP connect: Can't assign requested address or "how to determine the outgoing IP address?" X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2003 03:06:08 -0000 On Wed, Oct 22, 2003 at 07:53:10PM -0700, Lev Walkin wrote: > Everything's fine apart from one thing: connect() does not like to > connect to places with destination port equal to zero. > /* > * This will do. Note that it assumes AF_INET. > */ > ((struct sockaddr_in *)res->ai_addr)->sin_port = htons(80); Many many many thanks for this! You're a champ! Edwin, will never forgot this lesson. -- Edwin Groothuis | Personal website: http://www.mavetju.org edwin@mavetju.org | Weblog: http://www.mavetju.org/weblog/weblog.php