From: Stefan Schwarzer <sts@boa.ica1.uni-stuttgart.de>
Subject: gethostbyname
Date: 15 Dec 2000 21:41:07 GMT [thread overview]
Message-ID: <91e35j$14j$1@infosun2.rus.uni-stuttgart.de> (raw)
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 <netdb.h> // gethostbyname
#include <unistd.h> // close, gethostname
#include <stdio.h>
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
next reply other threads:[~2000-12-15 21:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-12-15 21:41 Stefan Schwarzer [this message]
2000-12-19 22:14 ` gethostbyname Joe Mario
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox