Return to BSD News archive
Xref: sserve comp.unix.bsd:15033 comp.unix.wizards:32519 comp.os.386bsd.questions:13620 Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!spool.mu.edu!howland.reston.ans.net!news.cac.psu.edu!news.pop.psu.edu!news.pop.psu.edu!not-for-mail From: tls@panix.com (Thor Lancelot Simon) Newsgroups: comp.unix.bsd,comp.unix.wizards,comp.os.386bsd.questions Subject: ifconfig alias: now how do I know who I am? Date: 5 Oct 1994 18:21:41 -0400 Organization: PANIX Public Access Internet and Unix, NYC Lines: 24 Sender: barr@pop.psu.edu Approved: barr@pop.psu.edu Message-ID: <36v8tl$5pf@bosnia.pop.psu.edu> NNTP-Posting-Host: bosnia.pop.psu.edu Consider the following problem: I have a machine which is running a http server. I want it to run only one http daemon, but provide different hierarchies of documents depending upon which IP address it's being talked to as. For example: www.panix.com is an A record for 198.7.0.90. www.customer.com is an A record for 198.7.0.91. I use ifconfig alias to tell www.panix.com that its ethernet interface is *both* 198.7.0.90 *and* 198.7.0.91. Now I want to distinguish between connections to 198.7.0.90 and 198.7.0.91 so that http://www.panix.com/ and http://www.customer.com really are URLs pointing to different data. What I need to know, here, is how I find out what the address I'm _recieving_ a message on is. Having learned about sockets just by futzing with other people's code, I have no idea how to do this. In fact, I'm not sure I've ever encountered code that does this at all. What's the magic word? [ getsockname()? --mod ] -- Thor Lancelot Simon tls@panix.COM - What is hardest to accept about the passage of time is that the people who - - once mattered the most to us are wrapped up in parentheses. --John Irving -