Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Feb 1996 17:15:28 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        ejs@bfd.com (Eric J. Schwertfeger)
Cc:        questions@FreeBSD.ORG
Subject:   Re: Q: programming sockets source address?
Message-ID:  <199602130015.RAA21557@phaeton.artisoft.com>
In-Reply-To: <Pine.BSF.3.91.960212135045.22730B-100000@harlie.bfd.com> from "Eric J. Schwertfeger" at Feb 12, 96 01:59:08 pm

next in thread | previous 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)?

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.



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