[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gethostbyname function



   Date: Mon, 09 Aug 1999 13:49:36 +0200
   From: Emmanuel Raguet <raguet at crf.canon.fr>

   I have a question about network features. 

   I want to obtain the IP address of my target.

   I use gethostname to obtain the name of the target. It 
   works well.
   When I call gethostbyname(server_name), I obtain NULL
   because /etc/hosts cannot be opened.
   Currently I use the field ip_address in the rtems_bsdnet_ifconfig
   structure. But I want to know if the gethostbyname (and others like
   gethostbyaddr,...) works and how to enable it.

gethostbyname does work for me.  The fact that /etc/hosts can not be
opened does not matter.  gethostbyname will try to get the host name
using DNS, by calling _gethostbydnsname.  You do have to configure at
least one name server in the rtems_bsdnet_config structure, and that
name server does have to be working.

Ian