Re: Correct way to determine machine's IP address in Cocoa
Re: Correct way to determine machine's IP address in Cocoa
- Subject: Re: Correct way to determine machine's IP address in Cocoa
- From: Malte Tancred <email@hidden>
- Date: Mon, 22 Apr 2002 08:45:24 +0200
On sunday, april 21, 2002, at 07:38 , Jamie Curmi wrote:
Hi All,
Does anyone know what the best/correct way to determine the IP address
of a given machine is?
I've tried a number of things with different amounts of success:
1) NSHost
Doing something like:
[[NSHost currentHost] address]
Seems to work sometimes, but sometimes it just returns 127.0.0.1
One machine can have many addresses. A machine connected to a network
will have at least two addresses, of which 127.0.0.1 i one. NSHost's
-address will give you one of these addresses whereas -addresses will
give you all of them.
Cheerio,
Malte
_______________________________________________
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.