---
title: "connectionWithReceivePort:sendPort:"
framework: foundation
role: symbol
role_heading: Type Method
path: "foundation/nsconnection/connectionwithreceiveport:sendport:"
---

# connectionWithReceivePort:sendPort:

Returns an NSConnection object that communicates using given send and receive ports.

## Declaration

```occ
+ (instancetype) connectionWithReceivePort:(NSPort *) receivePort sendPort:(NSPort *) sendPort;
```

## Parameters

- `receivePort`: A receive port.
- `sendPort`: A send port.

## Return Value

Return Value An NSConnection object that communicates using receivePort and sendPort.

## Discussion

Discussion See initWithReceivePort:sendPort: for more information.

## See Also

### Related Documentation

- [defaultConnection](foundation/nsconnection/defaultconnection.md)

### Creating Instances

- [initWithReceivePort:sendPort:](foundation/nsconnection/initwithreceiveport:sendport:.md)
