Receive data from the socket. The received data is written into *buf* (a writable buffer). The return value is a tuple of (number of bytes written, address).
(self, sock, buf, nbytes=0)
| 489 | fut.set_result(result) |
| 490 | |
| 491 | async def sock_recvfrom_into(self, sock, buf, nbytes=0): |
| 492 | """Receive data from the socket. |
| 493 | |
| 494 | The received data is written into *buf* (a writable buffer). |
| 495 | The return value is a tuple of (number of bytes written, address). |
| 496 | """ |
| 497 | base_events._check_ssl_socket(sock) |
| 498 | if self._debug and sock.gettimeout() != 0: |
| 499 | raise ValueError("the socket must be non-blocking") |
| 500 | if not nbytes: |
| 501 | nbytes = len(buf) |
| 502 | |
| 503 | try: |
| 504 | return sock.recvfrom_into(buf, nbytes) |
| 505 | except (BlockingIOError, InterruptedError): |
| 506 | pass |
| 507 | fut = self.create_future() |
| 508 | fd = sock.fileno() |
| 509 | self._ensure_fd_no_transport(fd) |
| 510 | handle = self._add_reader(fd, self._sock_recvfrom_into, fut, sock, buf, |
| 511 | nbytes) |
| 512 | fut.add_done_callback( |
| 513 | functools.partial(self._sock_read_done, fd, handle=handle)) |
| 514 | return await fut |
| 515 | |
| 516 | def _sock_recvfrom_into(self, fut, sock, buf, bufsize): |
| 517 | # _sock_recv_into() can add itself as an I/O callback if the operation |
nothing calls this directly
no test coverage detected