From owner-freebsd-questions Mon Feb 12 16:19:43 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id QAA16167 for questions-outgoing; Mon, 12 Feb 1996 16:19:43 -0800 (PST) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id QAA16162 for ; Mon, 12 Feb 1996 16:19:41 -0800 (PST) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id RAA21557; Mon, 12 Feb 1996 17:15:29 -0700 From: Terry Lambert Message-Id: <199602130015.RAA21557@phaeton.artisoft.com> Subject: Re: Q: programming sockets source address? To: ejs@bfd.com (Eric J. Schwertfeger) Date: Mon, 12 Feb 1996 17:15:28 -0700 (MST) Cc: questions@FreeBSD.ORG In-Reply-To: from "Eric J. Schwertfeger" at Feb 12, 96 01:59:08 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-questions@FreeBSD.ORG Precedence: bulk > > Once again, for lack of a newsfeed, I bring my questions to the FreeBSD > lists. Sorry for the annoyance. > > I'm involved in a project where I need to control the source address of a > socket used in a connect() call. Basically, the service I need to > connect to can only accept one connect from each address, but they'll let > us connect from 4 machines. What I need to do is set up a machine with 4 > addresses, then open a connection to the server machine from each of the > 4 addresses. > > So far, my initial attempts to use bind() before connect() have been a > wash, as bind returns an errno of EADDRNOTAVAIL, regardless of which > address I'm using. I was under the impression that bind could be used > before a connect to set the source address. Is this wrong? Is there a > correct way to do this (needs to be portable to Linux)? man rresvport. You probably are trying to bind a socket to a port below 1024; these are reserved ports. You must be root, as these are used for vouchsafe protocols, like rcmd and/or rlogin/rcp/rsh. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.