home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / programm / 4450 < prev    next >
Encoding:
Internet Message Format  |  1992-08-26  |  1.8 KB

  1. Xref: sparky comp.unix.programmer:4450 comp.unix.wizards:3693
  2. Newsgroups: comp.unix.programmer,comp.unix.wizards
  3. Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!darwin.sura.net!Sirius.dfn.de!Urmel.Informatik.RWTH-Aachen.DE!physik.tu-muenchen.de!berg
  4. From: berg@physik.tu-muenchen.de (Stephen R. van den Berg)
  5. Subject: gethostbyname()  h_addr vs. h_addr_list[0]
  6. Message-ID: <1992Aug26.133119.29254@Urmel.Informatik.RWTH-Aachen.DE>
  7. Originator: berg@tabaqui
  8. Sender: news@Urmel.Informatik.RWTH-Aachen.DE (Newsfiles Owner)
  9. Nntp-Posting-Host: tabaqui
  10. Organization: Rechnerbetrieb Informatik  /  RWTH Aachen
  11. Date: Wed, 26 Aug 92 13:31:19 GMT
  12. Lines: 37
  13.  
  14. I partly have to draw upon your memory here.
  15.  
  16. While putting in some network support in a program of mine, I noticed that
  17. in the struct hostent returned by gethostbyname() there is an entry called:
  18.  
  19.     **h_addr_list
  20.  
  21. Now, looking at the include file <netdb.h> it seems that there used to be
  22. and entry called:
  23.  
  24.     **h_addr
  25.  
  26. in this struct, in the old days (it is marked as being needed for backward
  27. compatibility).
  28.  
  29. Now, some questions come to mind:
  30.  
  31.     - I suppose that some old versions of UNIX did not have the h_addr_list
  32.       member, but the h_addr member instead?
  33.  
  34.     - Is the h_addr_list list a list of pointers which is terminated with
  35.       a null-pointer?  (the man page is not very informative regarding to
  36.       this).
  37.  
  38.     - Can it ever happen that h_addr_list is empty?  (i.e. it will probably
  39.       contain only a null-pointer).
  40.  
  41.     - Is there any good reason, when accessing some machine, to take any
  42.       other address than the one pointed at by h_addr_list[0] ?
  43.  
  44. Any help would be appreciated.  Just trying to fill some undocumented
  45. portability-caveats here.
  46. -- 
  47. Sincerely,                                  berg@pool.informatik.rwth-aachen.de
  48.            Stephen R. van den Berg (AKA BuGless).    berg@physik.tu-muenchen.de
  49.  
  50. "Good moaning!"
  51.