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

# portForName:host:

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

## Declaration

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

## Parameters

- `name`: The name of the desired port.
- `host`: The name of the host. host is an Internet domain name (for example, “sales.anycorp.com”). If host is nil or empty, the local host is checked.

## Return Value

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

## See Also

### Looking up Ports

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