From owner-freebsd-hackers@FreeBSD.ORG Thu May 22 21:16:55 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 65A49106564A for ; Thu, 22 May 2008 21:16:55 +0000 (UTC) (envelope-from ticso@cicely7.cicely.de) Received: from raven.bwct.de (raven.bwct.de [85.159.14.73]) by mx1.freebsd.org (Postfix) with ESMTP id E67978FC0C for ; Thu, 22 May 2008 21:16:54 +0000 (UTC) (envelope-from ticso@cicely7.cicely.de) Received: from cicely5.cicely.de ([10.1.1.7]) by raven.bwct.de (8.13.4/8.13.4) with ESMTP id m4MLGnLF089724 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 22 May 2008 23:16:50 +0200 (CEST) (envelope-from ticso@cicely7.cicely.de) Received: from cicely7.cicely.de (cicely7.cicely.de [10.1.1.9]) by cicely5.cicely.de (8.14.2/8.14.2) with ESMTP id m4MLGhm7062125 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 22 May 2008 23:16:44 +0200 (CEST) (envelope-from ticso@cicely7.cicely.de) Received: from cicely7.cicely.de (localhost [127.0.0.1]) by cicely7.cicely.de (8.14.2/8.14.2) with ESMTP id m4MLGeJI056089; Thu, 22 May 2008 23:16:40 +0200 (CEST) (envelope-from ticso@cicely7.cicely.de) Received: (from ticso@localhost) by cicely7.cicely.de (8.14.2/8.14.2/Submit) id m4MLGdFc056088; Thu, 22 May 2008 23:16:39 +0200 (CEST) (envelope-from ticso) Date: Thu, 22 May 2008 23:16:39 +0200 From: Bernd Walter To: Bruce Cran Message-ID: <20080522211639.GA55771@cicely7.cicely.de> References: <839372.78392.qm@web46311.mail.sp1.yahoo.com> <4835BBD5.1050003@cran.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4835BBD5.1050003@cran.org.uk> X-Operating-System: FreeBSD cicely7.cicely.de 7.0-STABLE i386 User-Agent: Mutt/1.5.11 X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED=-1.8, BAYES_00=-2.599 autolearn=ham version=3.2.3 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on cicely12.cicely.de Cc: freebsd-hackers@freebsd.org, John Timony Subject: Re: How can I translate IP to hostname in C X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ticso@cicely.de List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 May 2008 21:16:55 -0000 On Thu, May 22, 2008 at 07:30:45PM +0100, Bruce Cran wrote: > 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 Ups - yes that's what I ment in my mail. I wrote getaddrinfo, which is the other direction... -- B.Walter http://www.bwct.de Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.