0

IMPORTANT EDIT

It seems I've caused a lot of confusion in this post by differentiating between 'internal' and 'external' IP addresses. Allow me to try to clarify:

Internal = PRIVATE IP ADDRESS
External = PUBLIC IP ADDRESS

The concept of internal and external were completely of my own invention. Apologies.

Hey Everyone,

With your help I've managed to get both internal and external ip addresses. The problem is the code that I've got is only valid for 10.5 and 10.6. Any advice or snippets for code that will run on 10.4?

Objective C and C only please :)

Thanks!

EDIT:

Okay, so it seems like my question has not really been clear. Let me try to rephrase. Right now I have code that can get me the IP addresses of my machine. The problem is that it uses PortMapper which only runs on 10.5 and above (see code). My question is this: Is there a way to get the IP addresses without using PortMapper?

Thanks!

http://developer.apple.com/mac/library/samplecode/PortMapper/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007879-Intro-DontLinkElementID_2

EDIT:

Man, do I have a lot to learn! As Vicky pointed out I should clarify: 10.5 and 10.6 are the Mac OS Leopard and Snow Leopard. I need my code to run on Tiger (10.4).

Eric Brotto
  • 53,471
  • 32
  • 129
  • 174
  • I've got no idea what you're talking about.... – nategoose Jul 22 '10 at 20:31
  • @natgoose. hmmmm... let me try to clarify: I'd like to know how to get the external and internal ip address, but using code that is valid for 10.4. All answers I've seen so far is for code that only works on 10.5 and 10.6. – Eric Brotto Jul 23 '10 at 11:36
  • 1
    I think his question is, "what's an 'internal IP address' and what's an 'external IP address'?" I don't know what you're talking about either, and a link to the code you've been looking at that works on 10.5 and 10.6 would be helpful, too. – Alex Jul 25 '10 at 18:26
  • Are you talking about IP address in 10.4.n.n and 10.5.n.n or what? – Vicky Jul 26 '10 at 10:11
  • Oh hang on, you mean MAC OS versions 10.4 and 10.5 ? You really need to learn how to phrase questions more clearly! – Vicky Jul 26 '10 at 10:12
  • @Alex, internal IP address is for private networks and external IP address is a public IP. This wiki link has the list of reserved IP addresses. http://en.wikipedia.org/wiki/IPv4#Private_networks. NAT is used for conversion between the two. On diffferent note- i don't get the question either. – Praveen S Jul 26 '10 at 10:13
  • @Vicky- i though the ip range from 10.x.x.x. – Praveen S Jul 26 '10 at 10:14
  • @Vicky. Thanks for pointing that out. I guess I'm too lost in my Mac world :( – Eric Brotto Jul 26 '10 at 10:17

2 Answers2

0

I tend to use GLIB Hostname and Network utilities when I need to play with IPs. GLIB Hostname utiliies . Not so sure about the concept of Internal/External IP.

Manuel Salvadores
  • 16,287
  • 5
  • 37
  • 56
0

Here is where you can get a Private IP Address. Once again, sorry about the confusion.

Community
  • 1
  • 1
Eric Brotto
  • 53,471
  • 32
  • 129
  • 174