• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Is there a clean way to get my default IP address.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is there a clean way to get my default IP address.


  • Subject: Re: Is there a clean way to get my default IP address.
  • From: "Justin C. Walker" <email@hidden>
  • Date: Tue, 6 Dec 2005 00:23:56 -0800


On Dec 5, 2005, at 23:50 , Dalton Hamilton wrote:

Her is a small c routing that will give you your IP address. Of course, there are multiple interfaces on a system and this example will grab the en0 IP address. As I'm sure you are aware, "netstat - in" will give you a list of interface names.

The problem, as suggested in TN1145 (pointed out by Rustam earlier), is that on a system like Mac OS X, the OP's goal isn't really achievable. There is nothing that qualifies as "the" or "my" IP address on a Mac OS X system.


The best you can hope for is to determine the default interface (using the SystemConfiguration framework), and select, more or less at random, one address on that interface.

TN1145 should be really be required reading :-}.

Cheers,

Justin

--
Justin C. Walker, Curmudgeon-at-Large
() The ASCII Ribbon Campaign
/\ Help Cure HTML Email



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Is there a clean way to get my default IP address.
      • From: "Peter Sichel" <email@hidden>
References: 
 >Is there a clean way to get my default IP address. (From: John Draper <email@hidden>)
 >Re: Is there a clean way to get my default IP address. (From: Dalton Hamilton <email@hidden>)

  • Prev by Date: Re: Is there a clean way to get my default IP address.
  • Next by Date: Re: Is there a clean way to get my default IP address.
  • Previous by thread: Re: Is there a clean way to get my default IP address.
  • Next by thread: Re: Is there a clean way to get my default IP address.
  • Index(es):
    • Date
    • Thread