Re: + (NSHost*) currentHost?
Re: + (NSHost*) currentHost?
- Subject: Re: + (NSHost*) currentHost?
- From: Chris Hanson <email@hidden>
- Date: Wed, 22 Oct 2003 13:33:26 -0500
On Oct 21, 2003, at 12:53 PM, petite_abeille wrote:
How do people deal with changing local host addresses?
There's an Apple Tech Note on living in a multi-homed environment. I
can't give the number off the top of my head, but it describes what you
need to do.
The short version is "Don't bind to a particular local address." That
is, if you're listening for connections, be sure you're listening on
INADDR_ANY.
And short of pooling +currentHost, what would be a "reasonable" way to
know that the local address has changed in the first place?
SystemConfiguration.framework (SCF) includes notifications that are
broadcast whenever a key changes. Since SCF manages network
configurations, that's what you want to use.
You can play around with /usr/sbin/scutil to see how this works.
-- Chris
--
Chris Hanson, bDistributed.com, Inc. | Email: email@hidden
Custom Mac OS X Development | Phone: +1-847-372-3955
http://bdistributed.com/ | Fax: +1-847-589-3738
http://bdistributed.com/Articles/ | Personal Email: email@hidden
_______________________________________________
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.