Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 May 2008 08:58:55 +0200 (CEST)
From:      Oliver Fromme <olli@lurza.secnetix.de>
To:        freebsd-hackers@FreeBSD.ORG, fabonacci@yahoo.com, bzeeb-lists@lists.zabbadoz.net
Subject:   Re: How can I translate IP to hostname in C
Message-ID:  <200805230658.m4N6wtm5005346@lurza.secnetix.de>
In-Reply-To: <20080522161214.Y47338@maildrop.int.zabbadoz.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Bjoern A. Zeeb wrote:
 > John Timony wrote:
 > > 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()?

gethostbyaddr() is considered obsolete, I think.
You should use getaddrinfo() instead, which is more
flexible and easier to use, and it enables you to
easily write code that is independent and agnostic
of the address family (IPv4 vs. IPv6 vs. others).
The manual page contains detailed example code.

Best regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

"The most important decision in [programming] language design
concerns what is to be left out."  --  Niklaus Wirth



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