home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.programmer
- Path: sparky!uunet!gatech!destroyer!ncar!niwot.scd.ucar.edu!morreale
- From: morreale@niwot.scd.ucar.edu (Peter W. Morreale, SCD Consulting)
- Subject: Converting inet names/addresses....
- Message-ID: <1992Aug17.214158.6393@ncar.ucar.edu>
- Keywords: gethostbyname() , etc....
- Sender: news@ncar.ucar.edu (USENET Maintenance)
- Organization: Scientific Computing Divison/NCAR Boulder, CO
- Distribution: usa
- Date: Mon, 17 Aug 1992 21:41:58 GMT
- Lines: 38
-
-
- On a Sun, I need the ability to convert:
-
- foo.bar.edu
-
- To it's inet number:
-
- 128.???.??.??
-
- (both are character strings....)
-
- Note that I need to do this independent of whether I'm on "foo" or not.
- (although in *all* cases, I (and "foo") are on the same sub-domain....)
-
- Yes, we are using a resolver and yes, I am very ignorant of network
- programming. I could parse /etc/hosts myself, but as we use the
- resolver, /etc/hosts is sometimes out of sync.... (or is it required to
- be in sync??)
-
- I've found gethostbyname(3) which returns the proper host (and an
- address in network byte order), and also inet_ntoa(3) (which converts a
- struct in_addr to the proper form) but for the life of me I can't figger
- out how to create a proper struct in_addr for inet_ntoa(). What I need
- is a:
-
- char *get_inet_a_addr_from_host_name(char *hostname)
-
- function. Note again that the host I'm interested in is always a
- remote host, not the local (is: current) host.
-
- (I hope this is the proper place for this request...)
- Thanks,
- -PWM
- --
- ------------------------------------------------------------------
- Peter W. Morreale email: morreale@ncar.ucar.edu
- Nat'l Center for Atmos Research voice: (303) 497-1293
- Scientific Computing Division
-