---
title: countOfBytesReceived
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/urlsessiontask/countofbytesreceived
---

# countOfBytesReceived

The number of bytes that the task has received from the server in the response body.

## Declaration

```swift
var countOfBytesReceived: Int64 { get }
```

## Discussion

Discussion To be notified when this value changes, implement the urlSession(_:dataTask:didReceive:) delegate method (for data and upload tasks) or the urlSession(_:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:) method (for download tasks).

## See Also

### Obtaining task progress

- [progress](foundation/urlsessiontask/progress.md)
- [countOfBytesExpectedToReceive](foundation/urlsessiontask/countofbytesexpectedtoreceive.md)
- [countOfBytesExpectedToSend](foundation/urlsessiontask/countofbytesexpectedtosend.md)
- [countOfBytesSent](foundation/urlsessiontask/countofbytessent.md)
- [NSURLSessionTransferSizeUnknown](foundation/nsurlsessiontransfersizeunknown.md)
