<!--
{
  "availability" : [
    "macCatalyst: 13.1.0 - 13.1.0",
    "macOS: 10.0.0 - 10.13.0"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSPortNameServer/registerPort:name:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPortNameServer(im)registerPort:name:"
  },
  "title" : "registerPort:name:"
}
-->

# registerPort:name:

Makes a given port available on the network under a specified name.

```
- (BOOL) registerPort:(NSPort *) port name:(NSString *) name;
```

## Parameters

`port`

The port to make available.

`name`

The name for the port.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if successful, <doc://com.apple.documentation/documentation/Swift/false> otherwise (for example, if another `NSPort` object  has already been registered under `name`).

## Discussion

A port can be registered under multiple names. If it is, it must be unregistered for each name with [`removePortForName:`](/documentation/Foundation/NSPortNameServer/removePortForName:) to make it completely unavailable.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)