MCPcopy Index your code
hub / github.com/python/cpython / sock_recvfrom_into

Method sock_recvfrom_into

Lib/asyncio/selector_events.py:491–514  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 8

_add_readerMethod · 0.95
partialMethod · 0.80
gettimeoutMethod · 0.45
recvfrom_intoMethod · 0.45
create_futureMethod · 0.45
filenoMethod · 0.45
add_done_callbackMethod · 0.45

Tested by

no test coverage detected