From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,23b001e688940261,start X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2000-12-15 13:41:15 PST Path: supernews.google.com!sn-xit-02!supernews.com!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!blackbush.xlink.net!rz.uni-karlsruhe.de!news.uni-stuttgart.de!not-for-mail From: Stefan Schwarzer Newsgroups: comp.unix.tru64 Subject: gethostbyname Date: 15 Dec 2000 21:41:07 GMT Organization: ICA 1, Stuttgart University Message-ID: <91e35j$14j$1@infosun2.rus.uni-stuttgart.de> NNTP-Posting-Host: boa.ica1.uni-stuttgart.de User-Agent: tin/1.4.2-20000205 ("Possession") (UNIX) (SunOS/5.7 (sun4u)) Xref: supernews.google.com comp.unix.tru64:1225 Maybe there is a Compaq network guru 'listening': I observed an oddity using gethostbyname on a True64 5.0/910 host Trying to set up two connected sockets for testing on the same host, I needed to figure out the address of the local host and coded up something along the lines of (simplified, modulo typos): #include // gethostbyname #include // close, gethostname #include int main(){ const int hlen = 129; char hostname[hlen]; struct hostent * pHost; gethostname( hostname, hlen ); /* this call is ok and delivers the official IP name of the host */ h_errno = 0; /* safety measure */ /* this should set h_errno to NETDB_SUCCESS (happens to be 0) on success: */ pHost = gethostbyname( hostname ); printf ( "value of h_errno: %d %d\n", h_errno , NETDB_SUCCESS ); } On 4.0 machines, the program prints ... 0 0 as I'd expect, on the 5.0/910 host I get ... 1 0 (meaning HOST_NOT_FOUND). I made sure that the gethostname call succeeds and the name is a legal address (manul.ica1.uni-stuttgart.de), resolved by nslookup. The binary address returned in pHost seems to be ok in the cases that I have tested. If I'd written 'gethostbyname' I'd consider this a bug. -- Stefan Schwarzer office: +49-(0)711-685-7606 fax: x-3658 Uni Stuttgart, ICA 1 (?- Pfaffenwaldring 27 //\ sts@ica1.uni-stuttgart.de 70569 Stuttgart, Germany -V_/---- http://www.ica1.uni-stuttgart.de/~sts