Internal and External IP Address in 10.4
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开发者_StackOverflow中文版 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).
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.
Here is where you can get a Private IP Address. Once again, sorry about the confusion.
精彩评论