• 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: local IP adresses / local host names
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: local IP adresses / local host names


  • Subject: Re: local IP adresses / local host names
  • From: Andreas Fink <email@hidden>
  • Date: Thu, 10 Jul 2008 11:30:10 +0000


On 10.07.2008, at 11:12, Quinn wrote:

At 10:24 +0000 10/7/08, Andreas Fink wrote:
What is the correct way to get a list of local IP adresses and local host names?

For IP addresses, TN1145 demonstrates a number of techniques.

<http://developer.apple.com/technotes/tn/tn1145.html>

For DNS names, the problem is not solvable even in theory: I can happily add an name in my personal domain ("anarchistturtle.com") that points to someone else's host, and there's no way that host can discover its new name.

One reasonable heuristic is to reverse DNS each of the IPs (using <x-man-page://3/getaddrinfo>, CFHost, or whatever), but that might not give you the answer you're expecting.  For example, my personal web server is "anarchistturtle.com" but if you reverse map its IP address you get "host217-41-101-22.in-addr.btopenworld.com".

If you can explain what you're using this information for, I can offer up some better heuristics.


I've looked at that information and its not useable in my case. Open Transport is definitively out of the picture. BSD Sockets are useable and in fact I use some similar code today to find out on incoming connection who connected to me and on which local ip. However I need this information at the time I set up connections.

Example: I'm connected to a corporate network via Ethernet and a WWAN network. I can bind to the WWAN IP or to the corporate IP or to "any". And same goes for IPv4 versus IPv6 sockets. To be able to decide on which IP's I want to listen to and to which I don't, I need to know what IP's are available on the system at the current time. So basically a list of IP Interfaces, their IP Addresses (IPv4 and IPv6) as they can have multiple. The host name is secondary and only used for display purposes. Reverse DNS or gethostname() should be sufficient in this case.

Andreas Fink
Fink Consulting GmbH
---------------------------------------------------------------
Tel: +41-61-6666332 Fax: +41-61-6666331  Mobile: +41-79-2457333
Address: Clarastrasse 3, 4058 Basel, Switzerland
E-Mail:  email@hidden
Homepage: http://www.finkconsulting.com
---------------------------------------------------------------
ICQ: 8239353 MSN: email@hidden AIM: smsrelay
Skype: andreasfink Yahoo: finkconsulting SMS: +41792457333

 _______________________________________________
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: local IP adresses / local host names
      • From: Quinn <email@hidden>
References: 
 >local IP adresses / local host names (From: Andreas Fink <email@hidden>)
 >Re: local IP adresses / local host names (From: Quinn <email@hidden>)

  • Prev by Date: Re: local IP adresses / local host names
  • Next by Date: Re: local IP adresses / local host names
  • Previous by thread: Re: local IP adresses / local host names
  • Next by thread: Re: local IP adresses / local host names
  • Index(es):
    • Date
    • Thread