---
title: NSPortNameServer
framework: foundation
role: symbol
role_heading: Class
path: foundation/nsportnameserver
---

# NSPortNameServer

An object-oriented interface to the port registration service used by the distributed objects system.

## Declaration

```occ
@interface NSPortNameServer : NSObject
```

## Overview

Overview NSConnection objects use this interface to contact each other and to distribute objects over the network; you should rarely need to interact directly with an NSPortNameServer. You get an NSPortNameServer object by using the systemDefaultPortNameServer class method—never allocate and initialize an instance directly. With the default server object you can register an Port object under a given name, making it available on the network, and also unregister it so that it can’t be looked up (although other applications that have already looked up the Port object  can still use it until it becomes invalid). See the Port class specification for more information.

## Topics

### Getting the Server Object

- [systemDefaultPortNameServer](foundation/nsportnameserver/systemdefaultportnameserver.md)

### Looking up Ports

- [portForName:](foundation/nsportnameserver/portforname:.md)
- [portForName:host:](foundation/nsportnameserver/portforname:host:.md)

### Registering Ports

- [registerPort:name:](foundation/nsportnameserver/registerport:name:.md)
- [removePortForName:](foundation/nsportnameserver/removeportforname:.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Inherited By

- [NSMachBootstrapServer](foundation/nsmachbootstrapserver.md)
- [NSMessagePortNameServer](foundation/nsmessageportnameserver.md)
- [NSSocketPortNameServer](foundation/nssocketportnameserver.md)

## See Also

### Legacy

- [NSMachPortDelegate](foundation/nsmachportdelegate.md)
- [NSConnectionDelegate](foundation/nsconnectiondelegate.md)
- [NSConnection](foundation/nsconnection.md)
- [NSDistantObject](foundation/nsdistantobject.md)
- [NSDistantObjectRequest](foundation/nsdistantobjectrequest.md)
- [NSMachBootstrapServer](foundation/nsmachbootstrapserver.md)
- [NSMachPort](foundation/nsmachport.md)
- [MessagePort](foundation/messageport.md)
- [NSMessagePortNameServer](foundation/nsmessageportnameserver.md)
- [NSPortCoder](foundation/nsportcoder.md)
- [PortDelegate](foundation/portdelegate.md)
- [PortMessage](foundation/portmessage.md)
- [NSProtocolChecker](foundation/nsprotocolchecker.md)
- [NSSocketPortNameServer](foundation/nssocketportnameserver.md)
