Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.unix.wizards Subject: Re: Determining one's own IP address. Message-ID: <21234@mimsy.umd.edu> Date: 12 Dec 89 17:59:16 GMT References: <601@bmers58.UUCP> <4429@ur-cc.UUCP> <604@bmers58.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 19 In article <604@bmers58.UUCP> davem@bmers58.UUCP (Dave Mielke) writes: >I would like to be able to determine my local IP address without >involving a hosts file or yp lookup, i.e. from memory, from within a c >program. Since your machine might have anywhere from zero to several hundred official IP addresses, this is not possible. The closest thing there is to `myself' is 127.0.0.1, which (I think) has now been officially reserved to mean `loopback' or `connect to myself'. 4BSD provides a `gethostid' call, but what you get is not necessarily a valid IP address. Since we had never set our hostid under 4.2BSD (setting it to zero, in effect), I am fairly sure that nothing in 4.2BSD actually used it. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris