[ LUGOS ] struct hostent

Matija Grabnar Matija.Grabnar na arnes.si
Tor Jan 13 13:25:59 CET 1998


> V Linuxovi dokumentaciji za C-jevo funkcijo gethostbyname piše, da
> je njen prototip tole:
> 
>         struct hostent *gethostbyname(const char *name);
> 
> kjer je tip hostent tole:
> 
>         struct hostent {
>                 char    *h_name;        /* official name of host */
>                 char    **h_aliases;    /* alias list */
>                 int     h_addrtype;     /* host address type */
>                 int     h_length;       /* length of address */
>                 char    **h_addr_list;  /* list of addresses */
>         }
> 
> Ali je število h_length lahko kdaj različno od 4 (ker so pač štiri
> številke, ločene s piko, v naslovu IP)?  Od česa je to odvisno?
Richard Stevens, Unix Network Programming, stran 393:
"Currently, the h_addrtype field always contains AF_INET, and similarly
the h_length field always contains 4 (the length of an internet address). For 
internet addresses, the array of pointers h_addr_list[0], h_addr_list[1], and 
so on, are not pointers to characters, but are pointers of type in_addr, which
we defined in Section 6.4. As you can see, lots of generality has been built 
ibto the hostent structure, most of which is not currently used. The reason
a given host might have more than one address is that a multihomed host has 
more than one interface, each with a different address."

Mimogrede, pri IPv6 (znanem tudi kot IP-NG), bo tista cifra po mojem 8.
-- 
"My name is Not Important. Not to friends. 
    But you can call me mr. Important"  - Not J. Important 
Matija.Grabnar na arnes.si





Dodatne informacije o seznamu Starilist