home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.unix.programmer:4450 comp.unix.wizards:3693
- Newsgroups: comp.unix.programmer,comp.unix.wizards
- 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
- From: berg@physik.tu-muenchen.de (Stephen R. van den Berg)
- Subject: gethostbyname() h_addr vs. h_addr_list[0]
- Message-ID: <1992Aug26.133119.29254@Urmel.Informatik.RWTH-Aachen.DE>
- Originator: berg@tabaqui
- Sender: news@Urmel.Informatik.RWTH-Aachen.DE (Newsfiles Owner)
- Nntp-Posting-Host: tabaqui
- Organization: Rechnerbetrieb Informatik / RWTH Aachen
- Date: Wed, 26 Aug 92 13:31:19 GMT
- Lines: 37
-
- I partly have to draw upon your memory here.
-
- While putting in some network support in a program of mine, I noticed that
- in the struct hostent returned by gethostbyname() there is an entry called:
-
- **h_addr_list
-
- Now, looking at the include file <netdb.h> it seems that there used to be
- and entry called:
-
- **h_addr
-
- in this struct, in the old days (it is marked as being needed for backward
- compatibility).
-
- Now, some questions come to mind:
-
- - I suppose that some old versions of UNIX did not have the h_addr_list
- member, but the h_addr member instead?
-
- - Is the h_addr_list list a list of pointers which is terminated with
- a null-pointer? (the man page is not very informative regarding to
- this).
-
- - Can it ever happen that h_addr_list is empty? (i.e. it will probably
- contain only a null-pointer).
-
- - Is there any good reason, when accessing some machine, to take any
- other address than the one pointed at by h_addr_list[0] ?
-
- Any help would be appreciated. Just trying to fill some undocumented
- portability-caveats here.
- --
- Sincerely, berg@pool.informatik.rwth-aachen.de
- Stephen R. van den Berg (AKA BuGless). berg@physik.tu-muenchen.de
-
- "Good moaning!"
-