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 end.
(self, b)
| 719 | self._timeout_occurred = False |
| 720 | |
| 721 | def readinto(self, b): |
| 722 | """Read up to len(b) bytes into the writable buffer *b* and return |
| 723 | the number of bytes read. If the socket is non-blocking and no bytes |
| 724 | are available, None is returned. |
| 725 | |
| 726 | If *b* is non-empty, a 0 return value indicates that the connection |
| 727 | was shutdown at the other end. |
| 728 | """ |
| 729 | self._checkClosed() |
| 730 | self._checkReadable() |
| 731 | if self._timeout_occurred: |
| 732 | raise OSError("cannot read from timed out object") |
| 733 | try: |
| 734 | return self._sock.recv_into(b) |
| 735 | except timeout: |
| 736 | self._timeout_occurred = True |
| 737 | raise |
| 738 | except error as e: |
| 739 | if e.errno in _blocking_errnos: |
| 740 | return None |
| 741 | raise |
| 742 | |
| 743 | def write(self, b): |
| 744 | """Write the given bytes or bytearray object *b* to the socket |
nothing calls this directly
no test coverage detected