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

# portForName:host:

Looks up and returns the port registered under the specified name.

## Declaration

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

## Parameters

- `name`: The name of the desired port.
- `host`: Because NSMachBootstrapServer is a local-only server; hostName must be the empty string or nil.

## Return Value

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

## See Also

### Looking up Ports

- [portForName:](foundation/nsmachbootstrapserver/portforname:.md)
- [servicePortWithName:](foundation/nsmachbootstrapserver/serviceportwithname:.md)
