MCPcopy Index your code
hub / github.com/RustPython/RustPython / sock_recvfrom

Method sock_recvfrom

Lib/asyncio/selector_events.py:448–469  ·  view source on GitHub ↗

Receive a datagram from a datagram socket. The return value is a tuple of (bytes, address) representing the datagram received and the address it came from. The maximum amount of data to be received at once is specified by nbytes.

(self, sock, bufsize)

Source from the content-addressed store, hash-verified

446 fut.set_result(nbytes)
447
448 async def sock_recvfrom(self, sock, bufsize):
449 """Receive a datagram from a datagram socket.
450
451 The return value is a tuple of (bytes, address) representing the
452 datagram received and the address it came from.
453 The maximum amount of data to be received at once is specified by
454 nbytes.
455 """
456 base_events._check_ssl_socket(sock)
457 if self._debug and sock.gettimeout() != 0:
458 raise ValueError("the socket must be non-blocking")
459 try:
460 return sock.recvfrom(bufsize)
461 except (BlockingIOError, InterruptedError):
462 pass
463 fut = self.create_future()
464 fd = sock.fileno()
465 self._ensure_fd_no_transport(fd)
466 handle = self._add_reader(fd, self._sock_recvfrom, fut, sock, bufsize)
467 fut.add_done_callback(
468 functools.partial(self._sock_read_done, fd, handle=handle))
469 return await fut
470
471 def _sock_recvfrom(self, fut, sock, bufsize):
472 # _sock_recvfrom() 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
recvfromMethod · 0.45
create_futureMethod · 0.45
filenoMethod · 0.45
add_done_callbackMethod · 0.45

Tested by

no test coverage detected