---
title: "receive(atLeast:atMost:)"
framework: network
role: symbol
role_heading: Instance Method
path: "network/networkchannel/receive(atleast:atmost:)"
---

# receive(atLeast:atMost:)

Receive data from a connection

## Declaration

```swift
func receive(atLeast: Int = 1, atMost: Int) async throws -> ApplicationProtocol.Message<Data>
```

## Parameters

- `atLeast`: The minimum length to receive from the connection, until the content is complete.
- `atMost`: The maximum length to receive from the connection in a single completion.

## Discussion

Discussion This may be called before the connection is ready, in which case the receive request will be enqueued until the connection is ready.
