<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/URLSessionStreamDelegate/urlSession(_:readClosedFor:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(pl)NSURLSessionStreamDelegate(im)URLSession:readClosedForStreamTask:"
  },
  "title" : "urlSession(_:readClosedFor:)"
}
-->

# urlSession(_:readClosedFor:)

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

```
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

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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)