---
title: "portForName:"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsmessageportnameserver/portforname:"
---

# portForName:

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

## Declaration

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

## Parameters

- `name`: The port name.

## Return Value

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

## See Also

### Getting Ports By Name

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