Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mimsy!steve From: steve@mimsy.UUCP (Steve D. Miller) Newsgroups: comp.unix.wizards,comp.bugs.4bsd Subject: Re: What mode should `whois' be? Message-ID: <4657@mimsy.UUCP> Date: Fri, 5-Dec-86 10:07:44 EST Article-I.D.: mimsy.4657 Posted: Fri Dec 5 10:07:44 1986 Date-Received: Fri, 5-Dec-86 22:30:52 EST References: <782@smeagol.UUCP> Reply-To: steve@mimsy.UUCP (Steve D. Miller) Organization: Computer Sci. Dept, U of Maryland, College Park, MD Lines: 29 Keywords: BSD whois Summary: garbage args Xref: mnetor comp.unix.wizards:257 comp.bugs.4bsd:58 AHA! I looked at the source, and here's the *real* problem: struct sockaddr sin; sin.sin_family = AF_INET; if (bind(&sin, sizeof(sin)) < 0) ... 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. There are two fixes: (1) Remove the bind() call entirely; the connect() will pick a local socket automagically, as Phil Budne (budd@bu-cs) stated. (2) stick a "bzero((char *)&sin, sizeof(sin))" just before the "sin.sin_family = AF_INET". It will then bind a proper address, and everything will work as advertised. Time to send another bug report to Sun... -Steve -- Spoken: Steve Miller ARPA: steve@mimsy.umd.edu Phone: +1-301-454-4251 CSNet: steve@mimsy UUCP: {seismo,allegra}!mimsy!steve USPS: Computer Science Dept., University of Maryland, College Park, MD 20742