From: noyd@u.washington.edu (Steve Jones)
Subject: Re: gethostbyname
Date: 1997/01/02 [thread overview]
Message-ID: <5ahhej$o91@nntp1.u.washington.edu> (raw)
In-Reply-To: 32CC1643.41C6@watson.ibm.com
In article <5ahgvg$o45@nntp1.u.washington.edu>,
Steve Jones <noyd@u.washington.edu> wrote:
>In article <32CC1643.41C6@watson.ibm.com>,
>Austel Paula K <paula@watson.ibm.com> wrote:
>>I'm calling gethostbyname in a test program that works on other unix
>>systems and fails on dec osf. If I give gethostbyname an ip address
>>with dots in it I get HOST_NOT_FOUND. I can ping this ip address
>>from my dec machine. Any ideas.
>>
>>--
>>Paula Sweeney Austel
>>IBM Visualization Data Explorer Development
>>T.J. Watson Research Center
I've having a similar problem with gethostbyname, but with domain names,
not IP addresses.
#include <stdio.h>
#include <netdb.h>
#include <sys/socket.h>
main(int argc, char **argv)
{
struct hostent *ha = 0, *server_host = 0;
if (argv[1] == NULL) {
fprintf(stderr,"No argument to %s!\n",argv[0]);
exit(1);
}
ha = gethostbyname(argv[1]);
server_host = gethostbyaddr(ha->h_addr_list[0],4,AF_INET);
if ( server_host ) {
fprintf(stderr,"%s\n",server_host->h_name);
exit(0);
} else {
exit(1);
}
}
Running this program:
./a.out 140.142.83.2
saul4.u.washington.edu
./a.out saul4.u.washington.edu
(no output)
If I modify the hosts entry in the /etc/svc.conf file from
hosts=local,bind
to
hosts=bind,local
it works correctly.
This is a bug I think, any news on a fix?
--
--
Steven Jones
Computing & Communications 354843, University of Washington
E-mail: noyd@u.washington.edu Phone: (206) 543-5852
next prev parent reply other threads:[~1997-01-02 5:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-01-02 5:00 gethostbyname Austel Paula K
1997-01-02 5:00 ` Steve Jones [this message]
1997-01-03 5:00 ` gethostbyname John Hascall
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