Asynchronously reads all data from the socket until it is closed. This will buffer all available data until ``max_buffer_size`` is reached. If flow control or cancellation are desired, use a loop with `read_bytes(partial=True) <.read_bytes>` instead. .. versionchang
(self)
| 471 | return future |
| 472 | |
| 473 | def read_until_close(self) -> Awaitable[bytes]: |
| 474 | """Asynchronously reads all data from the socket until it is closed. |
| 475 | |
| 476 | This will buffer all available data until ``max_buffer_size`` |
| 477 | is reached. If flow control or cancellation are desired, use a |
| 478 | loop with `read_bytes(partial=True) <.read_bytes>` instead. |
| 479 | |
| 480 | .. versionchanged:: 4.0 |
| 481 | The callback argument is now optional and a `.Future` will |
| 482 | be returned if it is omitted. |
| 483 | |
| 484 | .. versionchanged:: 6.0 |
| 485 | |
| 486 | The ``callback`` and ``streaming_callback`` arguments have |
| 487 | been removed. Use the returned `.Future` (and `read_bytes` |
| 488 | with ``partial=True`` for ``streaming_callback``) instead. |
| 489 | |
| 490 | """ |
| 491 | future = self._start_read() |
| 492 | if self.closed(): |
| 493 | self._finish_read(self._read_buffer_size) |
| 494 | return future |
| 495 | self._read_until_close = True |
| 496 | try: |
| 497 | self._try_inline_read() |
| 498 | except: |
| 499 | future.add_done_callback(lambda f: f.exception()) |
| 500 | raise |
| 501 | return future |
| 502 | |
| 503 | def write(self, data: Union[bytes, memoryview]) -> "Future[None]": |
| 504 | """Asynchronously write the given data to this stream. |