---
title: countOfBytesClientExpectsToReceive
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/urlsessiontask/countofbytesclientexpectstoreceive
---

# countOfBytesClientExpectsToReceive

A best-guess upper bound on the number of bytes the client expects to receive.

## Declaration

```swift
var countOfBytesClientExpectsToReceive: Int64 { get set }
```

## Mentioned in

Downloading files in the background

## Discussion

Discussion The value set for this property should account for the size of both HTTP response headers and the response body. If no value is specified, the system uses NSURLSessionTransferSizeUnknown instead. This property is used by the system to optimize the scheduling of URL session tasks. Developers are strongly encouraged to provide an approximate upper bound, or an exact byte count, if possible, rather than accept the default.

## See Also

### Scheduling tasks

- [countOfBytesClientExpectsToSend](foundation/urlsessiontask/countofbytesclientexpectstosend.md)
- [NSURLSessionTransferSizeUnknown](foundation/nsurlsessiontransfersizeunknown.md)
- [earliestBeginDate](foundation/urlsessiontask/earliestbegindate.md)
