Newsgroups: comp.unix.questions Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!barmar From: barmar@think.com (Barry Margolin) Subject: Re: INADDR_ANY Message-ID: <1991Jun30.062127.19532@Think.COM> Sender: news@Think.COM Reply-To: barmar@think.com Organization: Thinking Machines Corporation, Cambridge MA, USA References: <739@dove.nist.gov> Date: Sun, 30 Jun 91 06:21:27 GMT Lines: 21 In article <739@dove.nist.gov> coleman@bldrdoc.gov (Sean Coleman 497-5672 ) writes: >I have noticed that many server programs use INADDR_ANY to >as the server address when the server binds. Suppose the server >was running on a machine it an IP address of 132.163.128.29 and the >server program sets its address to this instead of INADDR_ANY, what >will happen? This should work. There are a few reasons for using INADDR_ANY. One is that it simplifies the program, as it doesn't have to look up the local address. A more important reason is that a host can have more than one address; in fact, most network hosts have at least two IP addresses: 127.0.0.1 (the semi-standard "localhost" address) and the addresses of each real network interface. If the server only specifies one local address, then it will only respond to connections sent to that specific address. -- Barry Margolin, Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar