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

Function recv_fds

Lib/socket.py:570–588  ·  view source on GitHub ↗

recv_fds(sock, bufsize, maxfds[, flags]) -> (data, list of file descriptors, msg_flags, address) Receive up to maxfds file descriptors returning the message data and a list containing the descriptors.

(sock, bufsize, maxfds, flags=0)

Source from the content-addressed store, hash-verified

568
569if hasattr(_socket.socket, "recvmsg"):
570 def recv_fds(sock, bufsize, maxfds, flags=0):
571 """ recv_fds(sock, bufsize, maxfds[, flags]) -> (data, list of file
572 descriptors, msg_flags, address)
573
574 Receive up to maxfds file descriptors returning the message
575 data and a list containing the descriptors.
576 """
577 import array
578
579 # Array of ints
580 fds = array.array("i")
581 msg, ancdata, flags, addr = sock.recvmsg(bufsize,
582 _socket.CMSG_LEN(maxfds * fds.itemsize))
583 for cmsg_level, cmsg_type, cmsg_data in ancdata:
584 if (cmsg_level == _socket.SOL_SOCKET and cmsg_type == _socket.SCM_RIGHTS):
585 fds.frombytes(cmsg_data[:
586 len(cmsg_data) - (len(cmsg_data) % fds.itemsize)])
587
588 return msg, list(fds), flags, addr
589 __all__.append("recv_fds")
590
591if hasattr(_socket.socket, "share"):

Callers

nothing calls this directly

Calls 4

lenFunction · 0.85
listClass · 0.85
frombytesMethod · 0.80
recvmsgMethod · 0.45

Tested by

no test coverage detected