Name

NSHost — Mac OS X 10.0

Synopsis

This class is used to perform host name lookup and IP address translation. Translations are provided by any services available to the operating system such as NetInfo, LDAP, or DNS. Instances of NSHost are created using one of three class methods: currentHost, hostWithAddress:, and hostWithName:. The first, currentHost, returns an NSHost object that contains information about the host running the application process. The methods hostWithName: and hostWithAddress: create NSHost objects for the host with the specified name or address. The name used in hostWithName: can be a simple host name, or it can be a fully qualified domain name. When creating a host object with hostWithAddress:, the IP address is specified as a string in dotted decimal format, such as 192.168.254.198. Once an instance of NSHost has been created, it can be queried for the IP addresses and names that the host identifies with.

image with no caption

@interface NSHost : NSObject
                                  // Convenience Constructors
   + (NSHost *)hostWithAddress:(NSString *)address;
   + (NSHost *)hostWithName:(NSString *)name;
                                  // Class Methods
   + (NSHost *)currentHost;
   + (void)flushHostCache;
   + (BOOL)isHostCacheEnabled;
   + (void)setHostCacheEnabled:(BOOL)flag;
                                  // Instance Methods
   - (NSString *)address;
   - (NSArray *)addresses;
   - (BOOL)isEqualToHost:(NSHost *)aHost;
   - (NSString *)name;
   - (NSArray *)names ...

Get Cocoa in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.