From owner-freebsd-questions Mon Feb 12 13:56:25 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id NAA04836 for questions-outgoing; Mon, 12 Feb 1996 13:56:25 -0800 (PST) Received: from horst.bfd.com ([204.160.242.10]) by freefall.freebsd.org (8.7.3/8.7.3) with ESMTP id NAA04828 for ; Mon, 12 Feb 1996 13:56:22 -0800 (PST) Received: from harlie.bfd.com (bastion.bfd.com [204.160.242.2]) by horst.bfd.com (8.7.3/8.7.3) with SMTP id NAA02478 for ; Mon, 12 Feb 1996 13:55:42 -0800 (PST) Date: Mon, 12 Feb 1996 13:59:08 -0800 (PST) From: "Eric J. Schwertfeger" To: questions@freebsd.org Subject: Q: programming sockets source address? Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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)? Feel free to answer in private email.