Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-crg!ames!ucbcad!ucbvax!ucbarpa.Berkeley.EDU!jordan From: jordan@ucbarpa.Berkeley.EDU (Jordan Hayes) Newsgroups: comp.unix.wizards,comp.bugs.4bsd Subject: Re: What mode should `whois' be? Message-ID: <16550@ucbvax.BERKELEY.EDU> Date: Sun, 7-Dec-86 02:36:06 EST Article-I.D.: ucbvax.16550 Posted: Sun Dec 7 02:36:06 1986 Date-Received: Sun, 7-Dec-86 07:07:28 EST References: <782@smeagol.UUCP> <4657@mimsy.UUCP> Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: jordan@ucbarpa.Berkeley.EDU (Jordan Hayes) Organization: University of California, Berkeley Lines: 30 Keywords: BSD whois Xref: mnetor comp.unix.wizards:277 comp.bugs.4bsd:63 Steve D. Miller writes: struct sockaddr sin; sin.sin_family = AF_INET; if (bind(&sin, sizeof(sin)) < 0) ... [ I assume you mean bind(s, &sin, sizeof(sin)) since bind() takes 3 arguments ] It's not trying to bind to any particular port on the local machine; it just wants the kernel to pick one for it. Unfortunately, the kernel does so only if no address is specified (all-zeroes), and this is specifying a garbage address. That's weird ... the 4.3 source says struct sockaddr_in sin; sin.sin_family = hp->h_addrtype; if (bind(s,&sin, sizeof(sin)) < 0) ... More portable, but still far from the point -- clients that talk to Internet Services (I.e., those with RFC's) shouldn't bind the socket locally -- the server should do that for you. You can't enforce the protected ports across non-BSD systems. You certainly shouldn't try to with whois ... /jordan