Up

# NSHost class reference

### Authors

Luke Howard (`lukeh@xedoc.com.au`)
Richard Frith-Macdonald (`richard@brainstorm.co.uk`)

Copyright: (C) 1996, 1997,1999 Free Software Foundation, Inc.

### Contents -

1. Software documentation for the NSHost class
2. Software documentation for the NSHost(GNUstep) category

# Software documentation for the NSHost class

## NSHost : NSObject

> Declared in:
>   Foundation/NSHost.h

Availability: OpenStep
Instances of this class encapsulate host information. Constructors based on host name or numeric address are provided.
Method summary

- +localHost
- +currentHost
- +flushHostCache
- +hostWithAddress:
- +hostWithName:
- +isHostCacheEnabled
- +setHostCacheEnabled:
- -address
- -addresses
- -isEqualToHost:
- -localizedName
- -name
- -names

### currentHost

+ (NSHost*) currentHost;
Availability: OpenStep
Get current host object.

### flushHostCache

+ (void) flushHostCache;
Availability: OpenStep
Clear cache of host info instances.

### hostWithAddress:

+ (NSHost*) hostWithAddress: (NSString*)address;
Availability: OpenStep
Get a host object. Hosts are cached for efficiency. The address must be an IPV4 "dotted decimal" string, e.g.

      NSHost aHost = [NSHost hostWithAddress:@"192.42.172.1"];

### hostWithName:

+ (NSHost*) hostWithName: (NSString*)name;
Availability: OpenStep
Get info for host with given DNS name.

### isHostCacheEnabled

+ (BOOL) isHostCacheEnabled;
Availability: OpenStep
Return host cache management. If enabled, only one object representing each host will be created, and a shared instance will be returned by all methods that return a host.

### setHostCacheEnabled:

+ (void) setHostCacheEnabled: (BOOL)flag;
Availability: OpenStep
Set host cache management. If enabled, only one object representing each host will be created, and a shared instance will be returned by all methods that return a host.

### address

- (NSString*) address;
Availability: OpenStep
Return host address in "dotted decimal" notation, e.g. "192.42.172.1". Chosen arbitrarily if a host has more than one.

### addresses

- (NSArray*) addresses;
Availability: OpenStep
Return all known addresses for host in "dotted decimal" notation, e.g. "192.42.172.1".

### isEqualToHost:

- (BOOL) isEqualToHost: (NSHost*)aHost;
Availability: OpenStep
Compare hosts. Hosts are equal if they share at least one address

### localizedName

- (NSString*) localizedName;
Availability: MacOS-X 10.6.0
If the receiver is the currentHost, returns the default name of the computer, otherwise returns `nil`.

### name

- (NSString*) name;
Availability: OpenStep
Return host name. Chosen arbitrarily if a host has more than one.

### names

- (NSArray*) names;
Availability: OpenStep
Return all known names for host.

# Software documentation for the NSHost(GNUstep) category

## NSHost(GNUstep)

> Declared in:
>   Foundation/NSHost.h

Availability: Base
Likely to be changed/moved/removed at 1.17.0
Adds synonym for +currentHost .
Method summary

- +localHost

### localHost

+ (NSHost*) localHost;
Availability: Base
Likely to be changed/moved/removed at 1.17.0
Synonym for +currentHost .

Up