Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 May 2008 19:30:45 +0100
From:      Bruce Cran <bruce@cran.org.uk>
To:        John Timony <fabonacci@yahoo.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: How can I translate IP to hostname in C
Message-ID:  <4835BBD5.1050003@cran.org.uk>
In-Reply-To: <839372.78392.qm@web46311.mail.sp1.yahoo.com>
References:  <839372.78392.qm@web46311.mail.sp1.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
John Timony wrote:
> Hi,guys
> 
> 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 could use gethostbyaddr(3), but those traditional functions have 
been replaced with more flexible versions such as getnameinfo(3) on 
newer systems.  There's a good introduction to modern sockets 
programming at http://people.redhat.com/drepper/userapi-ipv6.html

-- 
Bruce Cran



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