---
title: "urlSession(_:readClosedFor:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/urlsessionstreamdelegate/urlsession(_:readclosedfor:)"
---

# urlSession(_:readClosedFor:)

Tells the delegate that the read side of the underlying socket has been closed.

## Declaration

```swift
optional func urlSession(_ session: URLSession, readClosedFor streamTask: URLSessionStreamTask)
```

## Parameters

- `session`: The session containing the stream task that closed reads.
- `streamTask`: The stream task that closed reads.

## Discussion

Discussion This method may be called even if no reads are currently in progress. This method does not indicate that the stream reached end-of-file (EOF), such that no more data can be read.

## See Also

### Handling closing events

- [urlSession(_:writeClosedFor:)](foundation/urlsessionstreamdelegate/urlsession(_:writeclosedfor:).md)
