From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6576 invoked by alias); 28 Feb 2002 10:43:55 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 6477 invoked from network); 28 Feb 2002 10:43:52 -0000 Received: from unknown (HELO doul.iservindia.com) (203.168.74.30) by sources.redhat.com with SMTP; 28 Feb 2002 10:43:52 -0000 Received: from naini.zyberway.com [203.168.74.249] by doul.iservindia.com with ESMTP (SMTPD32-7.05) id AB272CC50130; Thu, 28 Feb 2002 16:19:11 +0530 Message-ID: <-1315982412.1014892412831.JavaMail.root@naini.zyberway.com> From: snodx@hotmail.com To: gcc-help@gcc.gnu.org Subject: Re: IP ADDRESS OF MACHINE Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Thu, 28 Feb 2002 03:25:00 -0000 X-SW-Source: 2002-02/txt/msg00296.txt.bz2 OK After reading Mr Rupert Wood's post I decided that enough is enough and decided to test whether a NetWork Card is installed on my system or not. So I connected an Internet Router to my Linux computer. If there is a NetWork Card installed on my computer then I should be able to access the Internet. And voila, there is a NetWork Card installed on my system. I had already set the Computer's TCP/IP Address to 192.168.0.2. The Internet router's address was set to 151.137.54.204 So by accessing the internet I was able to confirm that there is indeed a NetWork Card on my computer. But I decided to explore a bit further. I came across a command /bin/netstat I ran this command /bin/netstat --route This was the output that I got: Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 192.168.0.2 * 255.255.255.255 UH 0 0 0 eth0 192.168.0.0 * 255.255.255.0 U 0 0 0 eth0 127.0.0.0 * 255.0.0.0 U 0 0 0 lo default 151.137.54.204 0.0.0.0 UG 0 0 0 eth0 I am now slowly able to understand some of the Jargon that Mr Rupert wood was using. He talked about interfaces and I understand now that there is a EtherNet Interface eth0 installed on my system. So now this is the final-most-precise-version of my question: I have a EtherNet Interface eth0 installed on my system. The TCP/IP Address of my computer has been set to 192.168.0.2. I wish to develop a C/C++ program that can retrieve the local computer's TCP/IP Address. I DONT WANT THE PROGRAM TO SEARCH IN THE /etc/hosts FILE WHICH IS I BELIEVE USED FOR A DIFFERENT PURPOSE. In short I am looking for a program like /bin/netstat --route only this program is to be much much much simpler. It just needs to retrieve the TCP/IP Address 192.168.0.2 and display it. Thanx for everybody's inputs here. Awaiting a final reply. SNODX