---
title: closeRead()
framework: foundation
role: symbol
role_heading: Instance Method
path: foundation/urlsessionstreamtask/closeread()
---

# closeRead()

Completes any enqueued reads and writes, and then closes the read side of the underlying socket.

## Declaration

```swift
func closeRead()
```

## Discussion

Discussion You may continue to write data using the write(_:timeout:completionHandler:) method after calling this method. Any calls to readData(ofMinLength:maxLength:timeout:completionHandler:) after calling this method will result in an error.

## See Also

### Closing read and write sockets

- [closeWrite()](foundation/urlsessionstreamtask/closewrite().md)
