Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 May 2008 20:24:11 +0200
From:      Bernd Walter <ticso@cicely7.cicely.de>
To:        "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net>
Cc:        freebsd-hackers@freebsd.org, John Timony <fabonacci@yahoo.com>
Subject:   Re: How can I translate IP to hostname in C
Message-ID:  <20080522182410.GB55002@cicely7.cicely.de>
In-Reply-To: <20080522161214.Y47338@maildrop.int.zabbadoz.net>
References:  <839372.78392.qm@web46311.mail.sp1.yahoo.com> <20080522161214.Y47338@maildrop.int.zabbadoz.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, May 22, 2008 at 04:14:46PM +0000, Bjoern A. Zeeb wrote:
> On Thu, 22 May 2008, John Timony wrote:
> 
> Hi,
> 
> >I am writing a c program in FreeBSD,and I can not
> >translate a ip to hostname
> >,i wonder if there is a function to take this job...
> 
> You mean like gethostbyaddr()?
> 
> See also http://www.unixguide.net/network/socketfaq/2.24.shtml for
> further inspiration on this but slightly different topic.

You can also use the newer getaddrinfo(3)/freeaddrinfo(3).
I think it is bit easier to use and can it transparently handle inet6
addresses as well.
The only downside is that some rare old systems don't support it.
On FreeBSD it is suppoorted since FreeBSD-4, but some commerical
OS implemented it later.

-- 
B.Walter <bernd@bwct.de> http://www.bwct.de
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080522182410.GB55002>