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

Method sock_recv_into

Lib/asyncio/selector_events.py:413–432  ·  view source on GitHub ↗

Receive data from the socket. The received data is written into *buf* (a writable buffer). The return value is the number of bytes written.

(self, sock, buf)

Source from the content-addressed store, hash-verified

411 fut.set_result(data)
412
413 async def sock_recv_into(self, sock, buf):
414 """Receive data from the socket.
415
416 The received data is written into *buf* (a writable buffer).
417 The return value is the number of bytes written.
418 """
419 base_events._check_ssl_socket(sock)
420 if self._debug and sock.gettimeout() != 0:
421 raise ValueError("the socket must be non-blocking")
422 try:
423 return sock.recv_into(buf)
424 except (BlockingIOError, InterruptedError):
425 pass
426 fut = self.create_future()
427 fd = sock.fileno()
428 self._ensure_fd_no_transport(fd)
429 handle = self._add_reader(fd, self._sock_recv_into, fut, sock, buf)
430 fut.add_done_callback(
431 functools.partial(self._sock_read_done, fd, handle=handle))
432 return await fut
433
434 def _sock_recv_into(self, fut, sock, buf):
435 # _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
recv_intoMethod · 0.45
create_futureMethod · 0.45
filenoMethod · 0.45
add_done_callbackMethod · 0.45

Tested by

no test coverage detected