---
title: "readData(completionHandler:)"
framework: networkextension
role: symbol
role_heading: Instance Method
path: "networkextension/neappproxytcpflow/readdata(completionhandler:)"
---

# readData(completionHandler:)

Read data from the flow.

## Declaration

```swift
func readData(completionHandler: @escaping (Data?, (any Error)?) -> Void)
```

## Parameters

- `completionHandler`: A block that will be executed by the system on an internal system thread when some data is read from the flow. The block is passed either the data that was read or a non-nil error if an error occurred. See NEAppProxyFlowError in doc://com.apple.networkextension/documentation/NetworkExtension/NEAppProxyFlow for a list of possible errors. If the data parameter has a length of 0 then no data can be subsequently read from the flow. note: The completion handler is only called for the single read operation that was initiated by calling this method. If the caller wants to read more data then it should call this method again to schedule another read operation and another execution of the completion handler block.

## Mentioned in

Handling Flow Copying

## See Also

### Handling flow data

- [write(_:withCompletionHandler:)](networkextension/neappproxytcpflow/write(_:withcompletionhandler:).md)
