Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Classe « socket » Python 3.11.3

Méthode socket.socket.recvmsg

Signature de la méthode recvmsg

Description

help(socket.recvmsg)

recvmsg(bufsize[, ancbufsize[, flags]]) -> (data, ancdata, msg_flags, address)

Receive normal data (up to bufsize bytes) and ancillary data from the
socket.  The ancbufsize argument sets the size in bytes of the
internal buffer used to receive the ancillary data; it defaults to 0,
meaning that no ancillary data will be received.  Appropriate buffer
sizes for ancillary data can be calculated using CMSG_SPACE() or
CMSG_LEN(), and items which do not fit into the buffer might be
truncated or discarded.  The flags argument defaults to 0 and has the
same meaning as for recv().

The return value is a 4-tuple: (data, ancdata, msg_flags, address).
The data item is a bytes object holding the non-ancillary data
received.  The ancdata item is a list of zero or more tuples
(cmsg_level, cmsg_type, cmsg_data) representing the ancillary data
(control messages) received: cmsg_level and cmsg_type are integers
specifying the protocol level and protocol-specific type respectively,
and cmsg_data is a bytes object holding the associated data.  The
msg_flags item is the bitwise OR of various flags indicating
conditions on the received message; see your system documentation for
details.  If the receiving socket is unconnected, address is the
address of the sending socket, if available; otherwise, its value is
unspecified.

If recvmsg() raises an exception after the system call returns, it
will first attempt to close any file descriptors received via the
SCM_RIGHTS mechanism.