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

# portForName:

Looks up and returns the port registered under the specified name on the local host.

## Declaration

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

## Parameters

- `name`: The name of the desired port.

## Return Value

Return Value The port associated with portName on the local host. Returns nil if no such port exists.

## Discussion

Discussion Invokes portForName:host: with nil as the host name.

## See Also

### Looking up Ports

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