From owner-freebsd-java@FreeBSD.ORG Sat Dec 17 01:07:48 2005 Return-Path: X-Original-To: freebsd-java@freebsd.org Delivered-To: freebsd-java@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 70B6A16A41F for ; Sat, 17 Dec 2005 01:07:48 +0000 (GMT) (envelope-from prithula@yahoo.com) Received: from web52215.mail.yahoo.com (web52215.mail.yahoo.com [206.190.48.138]) by mx1.FreeBSD.org (Postfix) with SMTP id 4FD7843D5A for ; Sat, 17 Dec 2005 01:07:47 +0000 (GMT) (envelope-from prithula@yahoo.com) Received: (qmail 4541 invoked by uid 60001); 17 Dec 2005 01:07:46 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=3A/BKyjhY5NSxBIvqIQZET70CVa8jsORSj8nxbumLFLNHU/QujJFruw96eQ+BKkSvDDrGIOTyuw9tgqegbTwuat48tnL7H1Tq7xMjbikIm9N3FlRckkRmGuHuMDHXwkNgJXjSthHCsDIlqewmJQI7BsLiIemcmKYw7VtPoXz1Rc= ; Message-ID: <20051217010746.4539.qmail@web52215.mail.yahoo.com> Received: from [203.159.36.10] by web52215.mail.yahoo.com via HTTP; Fri, 16 Dec 2005 17:07:46 PST Date: Fri, 16 Dec 2005 17:07:46 -0800 (PST) From: PRITHU To: freebsd-java@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: getting IP address of host in FreeBSD X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Dec 2005 01:07:48 -0000 Dear all, I tried to get the IP address of the host in FreeBSD 5.4 using the getLocalhost() method of the InetAddress class. It gave an UnknownHost exception until I put the entry corresponding to the hostname in the file /etc/hosts. But, this solution is not good enough, since it requires to hard code the IP address and hostname mapping in the /etc/hosts/ file. Does anyone know how to get the IP address of the host by any other means? Thank You, Prithula Dhungel. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com