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

# portForName:

Returns the `NSPort` object registered under a given name on the local host.

```
- (NSPort *) portForName:(NSString *) name;
```

## Parameters

`name`

The port name.

## Return Value

The NSPort registered under `portName` on the local host Returns `nil` if a port named `portName` does not exist.

---

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)