Date: Mon, 12 Feb 1996 20:07:18 -0800 From: Terry Braun <tab@talking.com> To: ejs@bfd.com (Eric J. Schwertfeger) Cc: questions@FreeBSD.org, hackers@FreeBSD.org Subject: Re: Q: programming sockets source address? Message-ID: <199602130407.UAA04520@talking>
next in thread | raw e-mail | index | archive | help
Your message dated: Mon, 12 Feb 1996 17:40:46 PST > >> 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)? > I'm not sure what you are trying to do, but if you want to listen on a particular socket on you local machine, say on port 1520, this code will work- bindname.sin_addr.s_addr = htonl(INADDR_ANY); bindname.sin_family = AF_INET; bindname.sin_port = htons(1520); n = bind(sock, &bindname, sizeof(bindname)); \t -------- Terry Braun tab@talking.com Talking Networks, Inc. 510-525-6696
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199602130407.UAA04520>