• 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: Correct way to determine machine's IP address in Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Correct way to determine machine's IP address in Cocoa (From: Jamie Curmi <email@hidden>)

  • Prev by Date: Export data to Excel
  • Next by Date: GUI update, multi-threaded Cocoa Java app
  • Previous by thread: Re: Correct way to determine machine's IP address in Cocoa
  • Next by thread: question about Compiler Directives
  • Index(es):
    • Date
    • Thread