Ejemplo n.º 1
0
def sendfd(sock, fd, message="NONE"):
    """
    Sends a message and piggybacks a file descriptor via a Unix domain socket

    Note that the file descriptor cannot be sent by itself, at least
    one byte of payload needs to be sent also.

    :param sock: socket object or file descriptor for an `AF_UNIX` socket
    :param fd: file object or file descriptor to pass
    :param message: message to send
    :return: On success, sendfd returns the number of bytes sent, not including
             the file descriptor nor the control data.  If there was no message
             to send, 0 is returned.
    """
    return _passfd.sendfd(__check_socket(sock), __check_fd(fd), message)
Ejemplo n.º 2
0
def sendfd(sock, fd, message="NONE"):
    """Sends a message and piggybacks a file descriptor through a Unix
    domain socket.

    Note that the file descriptor cannot be sent by itself, at least
    one byte of payload needs to be sent also.

    Parameters:
     sock:    socket object or file descriptor for an AF_UNIX socket
     fd:      file object or file descriptor to pass
     message: message to send

    Return value:
    On success, sendfd returns the number of bytes sent, not including
    the file descriptor nor the control data.  If there was no message
    to send, 0 is returned."""

    import _passfd
    return _passfd.sendfd(__check_socket(sock), __check_fd(fd), message)
Ejemplo n.º 3
0
def sendfd(sock, fd, message = "NONE"):
    """Sends a message and piggybacks a file descriptor through a Unix
    domain socket.

    Note that the file descriptor cannot be sent by itself, at least
    one byte of payload needs to be sent also.

    Parameters:
     sock:    socket object or file descriptor for an AF_UNIX socket
     fd:      file object or file descriptor to pass
     message: message to send

    Return value:
    On success, sendfd returns the number of bytes sent, not including
    the file descriptor nor the control data.  If there was no message
    to send, 0 is returned."""
    
    import _passfd
    return _passfd.sendfd(__check_socket(sock), __check_fd(fd), message)