MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / readinto

Method readinto

tools/python-3.11.9-amd64/Lib/socket.py:692–713  ·  view source on GitHub ↗

Read up to len(b) bytes into the writable buffer *b* and return the number of bytes read. If the socket is non-blocking and no bytes are available, None is returned. If *b* is non-empty, a 0 return value indicates that the connection was shutdown at the other e

(self, b)

Source from the content-addressed store, hash-verified

690 self._timeout_occurred = False
691
692 def readinto(self, b):
693 """Read up to len(b) bytes into the writable buffer *b* and return
694 the number of bytes read. If the socket is non-blocking and no bytes
695 are available, None is returned.
696
697 If *b* is non-empty, a 0 return value indicates that the connection
698 was shutdown at the other end.
699 """
700 self._checkClosed()
701 self._checkReadable()
702 if self._timeout_occurred:
703 raise OSError("cannot read from timed out object")
704 while True:
705 try:
706 return self._sock.recv_into(b)
707 except timeout:
708 self._timeout_occurred = True
709 raise
710 except error as e:
711 if e.errno in _blocking_errnos:
712 return None
713 raise
714
715 def write(self, b):
716 """Write the given bytes or bytearray object *b* to the socket

Callers

nothing calls this directly

Calls 3

_checkClosedMethod · 0.45
_checkReadableMethod · 0.45
recv_intoMethod · 0.45

Tested by

no test coverage detected