Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8605001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:42:59+00:00 2026-06-12T02:42:59+00:00

I have the following code snippet which is returning the correct IPV4 Address. NSArray

  • 0

I have the following code snippet which is returning the correct IPV4 Address.

NSArray *addresses = [[NSHost currentHost] addresses];
NSString *stringAddress;

for (NSString *anAddress in addresses) {
    if (![anAddress hasPrefix:@"127"] && [[anAddress componentsSeparatedByString:@"."] count] == 4) {
        stringAddress = anAddress;
        NSLog(@"stringAddress is %@",stringAddress);
        break;
    } else {
   //     Do Something
    }
}

After running this application,these are the IPAddresses that NSHost address displaying.

2012-10-01 17:30:45.722 GetIPV6Address[1928:403] addresses is (
    "fe80::426c:8fff:fe07:f4e4%en0",
    "fdc7:2c68:e800::426c:8fff:fe07:f5e5",
    "fdc7:2c68:e800::fd62:f01c:155d:3228",                                                                                                  
    "fe80::7ec3:a1ff:fea5:c32d%en1",
    "198.168.10.144",)    

In my system preferences,I can see that my IPV4 address is 198.168.10.144 and IPV6 address is fdc7:2c68:e800::426c:8fff:fe07:f5e5.

This list is not always in the same sequence,so I am not able to get the right IP Address dynamically.From the list how could I find out that fdc7:2c68:e800::426c:8fff:fe07:f5e5 is my IPV6 address.Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T02:43:01+00:00Added an answer on June 12, 2026 at 2:43 am

    You obviously have 2 interfaces, en0 and en1.

    Both have a fe80: address (link local), and both have as well a fdc7:2c68:e800::... one, whatever this is. (site-local?)

    They both should be reachable and usable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following very simple code snippet which is loaded from a separate
i have the following code snippet in my ANT File which compiles my project
i have the following code snippet. in which i just want to return PartyName
I have the following code snippet, which loads data from a CSV file into
I have the following snippet code: my $hostname = `host \`hostname\``; which this yields
I have the following code snippet which is working fine: ifstream NDSConfig( NDS.config )
I have the following code snippet in which I'm trying to print some statements
I have following code snippet in jquery.In which,I want to animate each element of
I have the following code snippet which uses'event' My fellow developers argue that the
I have following code snippet that i use to compile class at the run

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.