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

Method sock_sendto

Lib/asyncio/selector_events.py:583–608  ·  view source on GitHub ↗

Send data to the socket. The socket must be connected to a remote socket. This method continues to send data from data until either all data has been sent or an error occurs. None is returned on success. On error, an exception is raised, and there is no way to determ

(self, sock, data, address)

Source from the content-addressed store, hash-verified

581 pos[0] = start
582
583 async def sock_sendto(self, sock, data, address):
584 """Send data to the socket.
585
586 The socket must be connected to a remote socket. This method continues
587 to send data from data until either all data has been sent or an
588 error occurs. None is returned on success. On error, an exception is
589 raised, and there is no way to determine how much data, if any, was
590 successfully processed by the receiving end of the connection.
591 """
592 base_events._check_ssl_socket(sock)
593 if self._debug and sock.gettimeout() != 0:
594 raise ValueError("the socket must be non-blocking")
595 try:
596 return sock.sendto(data, address)
597 except (BlockingIOError, InterruptedError):
598 pass
599
600 fut = self.create_future()
601 fd = sock.fileno()
602 self._ensure_fd_no_transport(fd)
603 # use a trick with a list in closure to store a mutable state
604 handle = self._add_writer(fd, self._sock_sendto, fut, sock, data,
605 address)
606 fut.add_done_callback(
607 functools.partial(self._sock_write_done, fd, handle=handle))
608 return await fut
609
610 def _sock_sendto(self, fut, sock, data, address):
611 if fut.done():

Callers

nothing calls this directly

Calls 8

_add_writerMethod · 0.95
partialMethod · 0.80
gettimeoutMethod · 0.45
sendtoMethod · 0.45
create_futureMethod · 0.45
filenoMethod · 0.45
add_done_callbackMethod · 0.45

Tested by

no test coverage detected