Return to BSD News archive
Xref: sserve comp.unix.bsd.freebsd.misc:1076 comp.protocols.tcp-ip:36345 Newsgroups: comp.unix.bsd.freebsd.misc,comp.protocols.tcp-ip Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!yarrina.connect.com.au!classic.iinet.com.au!news.uoknor.edu!news.ecn.uoknor.edu!paladin.american.edu!zombie.ncsc.mil!news.mathworks.com!gatech!swrinde!cs.utexas.edu!news.sprintlink.net!mv!mv.mv.com!shaman From: shaman@mv.mv.com (Coranth Gryphon) Subject: IP address of local machine Message-ID: <D8Fs2t.Cr7@mv.mv.com> Nntp-Posting-Host: mv.mv.com Sender: Coranth Gryphon <gryphon@healer.com> Organization: MV Communications, Inc. Date: Thu, 11 May 1995 23:04:05 GMT Followup-To: comp.unix.bsd.freebsd Lines: 23 Hi. I am trying to get a program to get the ip address of the machine that it is running on. The function "gethostbyname" returns a "struct hostent" which has the "h_addr" field. All well and good. However the bytes in this 4-byte string seem to have no relation to my ip address. The functions for converting between ip-addr-number and dot-form take a "struct in_addr". But I cannot find anything to convert from a hostent to an in_addr. Any ideas? -coranth --------------------------------------------------------+---------------------- Coranth Gryphon | Reality exists on a | need-to-know basis. E-Mail: gryphon@healer.com, shaman@mv.mv.com | Pager: (603) 599-0357 Phone: (603) 598-3440 | You do not currently US-Mail: 11 Carver Street, Nashua, NH 03060-2518 | need to know Disclaimer: All these words are yours, except Europa... +----------------------