Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* gethostbyname
@ 1997-01-02  5:00 Austel Paula K
  1997-01-02  5:00 ` gethostbyname Steve Jones
  1997-01-03  5:00 ` gethostbyname John Hascall
  0 siblings, 2 replies; 3+ messages in thread
From: Austel Paula K @ 1997-01-02  5:00 UTC (permalink / raw)



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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gethostbyname
  1997-01-02  5:00 gethostbyname Austel Paula K
@ 1997-01-02  5:00 ` Steve Jones
  1997-01-03  5:00 ` gethostbyname John Hascall
  1 sibling, 0 replies; 3+ messages in thread
From: Steve Jones @ 1997-01-02  5:00 UTC (permalink / raw)



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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gethostbyname
  1997-01-02  5:00 gethostbyname Austel Paula K
  1997-01-02  5:00 ` gethostbyname Steve Jones
@ 1997-01-03  5:00 ` John Hascall
  1 sibling, 0 replies; 3+ messages in thread
From: John Hascall @ 1997-01-03  5:00 UTC (permalink / raw)



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.

     The general strategy is to call
         inet_addr()
     first and if that fails, then call
         gethostbyname()

John
-- 
John Hascall, Software Engr.        Shut up, be happy.  The conveniences you
ISU Computation Center              demanded are now mandatory. -Jello Biafra
mailto:john@iastate.edu
http://www.cc.iastate.edu/staff/systems/john/welcome.html  <-- the usual crud



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1997-01-03  5:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-01-02  5:00 gethostbyname Austel Paula K
1997-01-02  5:00 ` gethostbyname Steve Jones
1997-01-03  5:00 ` gethostbyname John Hascall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox