From owner-freebsd-questions Tue Feb 13 07:54:22 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id HAA19061 for questions-outgoing; Tue, 13 Feb 1996 07:54:22 -0800 (PST) Received: from halloran-eldar.lcs.mit.edu (halloran-eldar.lcs.mit.edu [18.26.0.159]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id HAA19056 for ; Tue, 13 Feb 1996 07:54:20 -0800 (PST) Received: by halloran-eldar.lcs.mit.edu; (5.65/1.1.8.2/19Aug95-0530PM) id AA30883; Tue, 13 Feb 1996 10:54:13 -0500 Date: Tue, 13 Feb 1996 10:54:13 -0500 From: "Garrett A. Wollman" Message-Id: <9602131554.AA30883@halloran-eldar.lcs.mit.edu> To: "Eric J. Schwertfeger" Cc: questions@freebsd.org Subject: Q: programming sockets source address? In-Reply-To: References: Sender: owner-questions@freebsd.org Precedence: bulk < 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