From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27310 invoked by alias); 28 Feb 2002 12:04:49 -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 27121 invoked from network); 28 Feb 2002 12:04:36 -0000 Received: from unknown (HELO gw.isdd.sk) (195.46.65.39) by sources.redhat.com with SMTP; 28 Feb 2002 12:04:36 -0000 Received: from liptak (liptak [10.10.1.164]) by gw.isdd.sk (Postfix) with SMTP id 9B91396D16 for ; Thu, 28 Feb 2002 13:04:24 +0100 (CET) From: =?iso-8859-2?Q?Michal_Lipt=E1k?= To: Subject: RE: IP ADDRESS OF MACHINE Date: Thu, 28 Feb 2002 04:30:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 In-Reply-To: <-1000098896.1014896787299.JavaMail.root@naini.zyberway.com> X-SW-Source: 2002-02/txt/msg00300.txt.bz2 I would connect to some internet IP address and use getsockname() on the connected socket.. int socket; sockaddr local_addr; socklen_t namelen=sizeof(local_addr); getsockname(socket,&local_addr,&namelen); printf("My IP is %s",inet_ntoa(local_addr.sin_addr)); m. > -----Original Message----- > From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org]On > Behalf Of snodx@hotmail.com > Sent: Thursday, February 28, 2002 1:02 PM > To: gcc-help@gcc.gnu.org > Subject: Re: IP ADDRESS OF MACHINE > > > Alright Mr Green, that was a nice point. Your post has made me > refine my question a bit more. > > Maybe there are several interfaces installed on a system. BUT the > interface > through which an internet browser like Netscape Navigator or Lynx > interacts with > the Internet HAS to be after all one. I am talking about THIS IP > Address that the > system is using to talk to the internet. How does the internet > browser access the > Internet? I want a C/C++ program to detect THIS interface and > display IT'S IP Address. > > That leads to the second part of your question is there a better > place where this > question can be posted. I think the best place would be where > network issues are > discussed. I shall indeed do so. I posted this question here because > > So now how do I obtain the TCP/IP Address of that interface > through which an internet > browser interacts? > > Thanks for the input anyway. > > SNODX >