Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Feb 1996 13:59:08 -0800 (PST)
From:      "Eric J. Schwertfeger" <ejs@bfd.com>
To:        questions@freebsd.org
Subject:   Q: programming sockets source address?
Message-ID:  <Pine.BSF.3.91.960212135045.22730B-100000@harlie.bfd.com>

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.960212135045.22730B-100000>