Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Feb 1996 10:54:13 -0500
From:      "Garrett A. Wollman" <wollman@lcs.mit.edu>
To:        "Eric J. Schwertfeger" <ejs@bfd.com>
Cc:        questions@freebsd.org
Subject:   Q: programming sockets source address?
Message-ID:  <9602131554.AA30883@halloran-eldar.lcs.mit.edu>
In-Reply-To: <Pine.BSF.3.91.960212135045.22730B-100000@harlie.bfd.com>
References:  <Pine.BSF.3.91.960212135045.22730B-100000@harlie.bfd.com>

next in thread | previous in thread | raw e-mail | index | archive | help
<<On Mon, 12 Feb 1996 13:59:08 -0800 (PST), "Eric J. Schwertfeger" <ejs@bfd.com> said:

> 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.

There are a number of possibilities:

	1) The padding in the structure was not zeroed.  Make sure to
	   call `memset(&sin, 0, sizeof sin)' before filling it in.

	2) The sin_len field is not set, or is set incorrectly.  Make
	   sure to set `sin.sin_len = sizeof sin' before using it.

	3) The sin_port field is set to a value between 1 and 1023,
	   and you are not root.  Pick another port.

	4) The sin_port and/or sin_addr fields are in the wrong
	   byte order.  Make sure that they are in network order.

-GAWollman

--
Garrett A. Wollman   | Shashish is simple, it's discreet, it's brief. ... 
wollman@lcs.mit.edu  | Shashish is the bonding of hearts in spite of distance.
Opinions not those of| It is a bond more powerful than absence.  We like people
MIT, LCS, ANA, or NSA| who like Shashish.  - Claude McKenzie + Florent Vollant



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