MCPcopy Create free account
hub / github.com/EasyIME/PIME / read_until_close

Method read_until_close

python/python3/tornado/iostream.py:480–508  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Calls 4

_start_readMethod · 0.95
closedMethod · 0.95
_finish_readMethod · 0.95
_try_inline_readMethod · 0.95