Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Oct 2003 13:06:00 +1000
From:      Edwin Groothuis <edwin@mavetju.org>
To:        Lev Walkin <vlm@netli.com>
Cc:        freebsd-net@freebsd.org
Subject:   Re: UDP connect: Can't assign requested address or "how to determine the outgoing IP address?"
Message-ID:  <20031023030600.GX59349@k7.mavetju>
In-Reply-To: <3F974296.9040304@netli.com>
References:  <20031023023146.GA34131@k7.mavetju> <3F974296.9040304@netli.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031023030600.GX59349>