• 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: Getting IP Address
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting IP Address


  • Subject: Re: Getting IP Address
  • From: Stéphane Sudre <email@hidden>
  • Date: Wed, 21 Jul 2004 12:38:29 +0200

On Jul 21, 2004, at 10:38 AM, Stephan Lichtenauer wrote:

Am 21.07.2004 um 07:07 schrieb David Cornell:

Hey, total newb here...

How do I get the dotted ip address of the currenthost, I'm currently using
NSHost but I get fe80::1. I need to get the real IP, such as 192.168.100.12
etc.

thanks in advance!
dave
_______________________________________________

Hi Dave,

fe80::1is a "real" IP address, so unless you *really* have a good reason to only show IPv4 addresses like 192.168.100.12, I think you shouldn't filter the NSHost output. Otherwise you unnecessarily break compatibility of your program with IPv6 networking.

Now If you nevertheless really want to do that, I also suggest you go the way that has already been proposed: Look only for addresses with "." in them.

An IPv6 address can be written with '.' into it.

http://www.faqs.org/rfcs/rfc3513.html

So the solution is more to avoid any address with ':'.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Getting IP Address
      • From: Stephan Lichtenauer <email@hidden>
References: 
 >Getting IP Address (From: "David Cornell" <email@hidden>)
 >Re: Getting IP Address (From: Stephan Lichtenauer <email@hidden>)

  • Prev by Date: ByHost Preferences
  • Next by Date: How to disable Apple's Bug Report Dialog when application crash?
  • Previous by thread: Re: Getting IP Address
  • Next by thread: Re: Getting IP Address
  • Index(es):
    • Date
    • Thread