home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / programm / 4343 < prev    next >
Encoding:
Text File  |  1992-08-17  |  1.7 KB  |  51 lines

  1. Newsgroups: comp.unix.programmer
  2. Path: sparky!uunet!gatech!destroyer!ncar!niwot.scd.ucar.edu!morreale
  3. From: morreale@niwot.scd.ucar.edu (Peter W. Morreale, SCD Consulting)
  4. Subject: Converting inet names/addresses....
  5. Message-ID: <1992Aug17.214158.6393@ncar.ucar.edu>
  6. Keywords:  gethostbyname() , etc....
  7. Sender: news@ncar.ucar.edu (USENET Maintenance)
  8. Organization: Scientific Computing Divison/NCAR Boulder, CO
  9. Distribution: usa
  10. Date: Mon, 17 Aug 1992 21:41:58 GMT
  11. Lines: 38
  12.  
  13.  
  14. On a Sun, I need the ability to convert:
  15.  
  16.      foo.bar.edu
  17.  
  18. To it's inet number:
  19.  
  20.     128.???.??.??
  21.  
  22. (both are character strings....)
  23.  
  24.  Note that I need to do this independent of whether I'm on "foo" or not.
  25.  (although in *all* cases, I (and "foo") are on the same sub-domain....) 
  26.  
  27. Yes, we are using a resolver and yes, I am very ignorant of network
  28. programming.  I could parse /etc/hosts myself, but as we use the
  29. resolver, /etc/hosts is sometimes out of sync....  (or is it required to
  30. be in sync??)
  31.  
  32. I've found gethostbyname(3) which returns the proper host (and an
  33. address in network byte order), and also inet_ntoa(3) (which converts a
  34. struct in_addr to the proper form) but for the life of me I can't figger
  35. out how to create a proper struct in_addr for inet_ntoa().  What I need
  36. is a:
  37.  
  38. char *get_inet_a_addr_from_host_name(char *hostname) 
  39.  
  40. function.  Note again that the host I'm interested in is always a
  41. remote host, not the local (is: current) host.
  42.  
  43. (I hope this is the proper place for this request...)
  44. Thanks,
  45. -PWM
  46. --
  47. ------------------------------------------------------------------
  48. Peter W. Morreale                  email:  morreale@ncar.ucar.edu
  49. Nat'l Center for Atmos Research    voice:  (303) 497-1293
  50. Scientific Computing Division     
  51.