---
title: "open(withLocalEndpoint:completionHandler:)"
framework: networkextension
role: symbol
role_heading: Instance Method
path: "networkextension/neappproxyflow/open(withlocalendpoint:completionhandler:)"
---

# open(withLocalEndpoint:completionHandler:)

Opens the flow, indicating to the system that the caller is ready to start receiving and sending data.

## Declaration

```swift
func open(withLocalEndpoint localEndpoint: NWHostEndpoint?, completionHandler: @escaping @Sendable ((any Error)?) -> Void)
```

```swift
func open(withLocalEndpoint localEndpoint: NWHostEndpoint?) async throws
```

## Parameters

- `localEndpoint`: An doc://com.apple.networkextension/documentation/NetworkExtension/NWHostEndpoint object that contains the address and port to set as the local address and local port of the flow. The system supplies this information to the app that triggered the creation of this flow in different ways, depending on the networking API the app used. For example, if the app used the Network framework, it gets this information from the doc://com.apple.documentation/documentation/Network/NWPath/localEndpoint property of the current path. If it used BSD Sockets, it gets this information by calling getsockname. Pass nil to have the system derive a value based on the address of the current primary physical interface.
- `completionHandler`: Called when the open operation is complete. This block has no return value and takes the following parameter:

## Discussion

Discussion An NEAppProxyFlow object starts out in the unopened state. When the system passes a flow to your app proxy provider by calling handleNewFlow(_:), to need to set up the state necessary to handle the flow’s data, and then call this method.

## See Also

### Managing the flow life cycle

- [closeReadWithError(_:)](networkextension/neappproxyflow/closereadwitherror(_:).md)
- [closeWriteWithError(_:)](networkextension/neappproxyflow/closewritewitherror(_:).md)
