• 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: IP of a connected Mac
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IP of a connected Mac


  • Subject: Re: IP of a connected Mac
  • From: Joshua Graessley <email@hidden>
  • Date: Mon, 6 Jan 2003 13:28:06 -0800

On Monday, January 6, 2003, at 11:37 AM, Justin Walker wrote:

On Monday, Jan 6, 2003, at 11:23 US/Pacific, Smith Kennedy wrote:

That's true, and it is unfortunate that the code snippet I threw out there won't return the "default" interface. Seems like a logical thing for that method to return, but the documentation says it will be "an arbitrary Internet address of the receiver".

It's hard to define the default interface. There really is no such thing. The best that can be done (I think) is to select the interface pointed to by the default route. That may not be the one desired, of course, wherein lies the rub.

There really needs to be a library layer that translates "the pile of interfaces and assigned network addresses" to a list ordered by some set of criteria. Determining that criteria will take some time and thought. The world of multihoming is a fairly new one for most users, and for most developers.

It's even more complicated than that though. Addresses have different scope. An IPv4LL address is only valid on the local link. In addition, a 10.x.x.x or 192.168.x.x address is only valid on that local network. Depending on what other host you're trying to contact, you may want to pick any number of addresses. Network setups can get fairly complicated. For example, at home, I've got 5 static IP addresses. One of those addresses is assigned to an AirPort base station that then turns around and shares it using NAT, creating 10.0.1.x. A server has both a 10.0.1.x address and a global address. This makes it easier to communicate directly with hosts behind the NAT and on the internet. Depending on which address you pick, the global one or the 10.0.1.x one, you can communicate with different hosts.

Many of our laptops ship with built-in and airport. In some locations, it is not unlikely that both will be active at the same time. For example, at work, I have a wired connection and a wireless one. If I want to communicate with another host that is on both the wired and wireless networks, it would be preferable to use the wired one but there is no for most of the software to know that.

In general, it's best to send all addresses to remote host and let the host decide which address to connect to. The only tricky part is making sure you don't forward an address beyond it's scope. It's fine to send an IPv4LL address in an IPv4 link-local multicast, but not a site-local multicast. A 10.x.x.x or 192.168.x.x address should not be forwarded off of the network for which that address is valid.

Is there a specific reason you're trying to get an IP address of the machine?

-josh
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: IP of a connected Mac
      • From: "Justin C. Walker" <email@hidden>
    • Re: IP of a connected Mac
      • From: Douglas Davidson <email@hidden>
References: 
 >Re: IP of a connected Mac (From: Justin Walker <email@hidden>)

  • Prev by Date: Re: IP of a connected Mac
  • Next by Date: Re: IP of a connected Mac
  • Previous by thread: Re: IP of a connected Mac
  • Next by thread: Re: IP of a connected Mac
  • Index(es):
    • Date
    • Thread