From owner-freebsd-hackers Thu Sep 14 1:56:25 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id 7A07F37B422 for ; Thu, 14 Sep 2000 01:56:23 -0700 (PDT) Received: from gosset.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 14 Sep 2000 09:56:22 +0100 (BST) Date: Thu, 14 Sep 2000 09:56:22 +0100 From: David Malone To: Chris Ptacek Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Getting all the IP address for a machine from code... Message-ID: <20000914095622.A25929@gosset.maths.tcd.ie> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from ptacek@dashmail.net on Wed, Sep 13, 2000 at 08:12:47PM -0700 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Wed, Sep 13, 2000 at 08:12:47PM -0700, Chris Ptacek wrote: > I am looking for a way to get all the IP addresses that are configured a > machine. I need to do this in c source code, and without using DNS services > (ie: gethostname/gethostbyname won't work). I am hoping there are some > system calls I can use to get this information. Thanks in advance for any > help. You could use getifaddrs in FreeBSD 4 and later - otherwise you'll need to use sysctl to get the list of interfaces and addresses. David. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message