Gio.UnixConnection.prototype.receive_fd

function receive_fd(cancellable: Gio.Cancellable): Number(gint) {
    // Gjs wrapper for g_unix_connection_receive_fd()
}
  

Receives a file descriptor from the sending end of the connection. The sending end has to call Gio.UnixConnection.prototype.send_fd for this to work.

As well as reading the fd this also reads a single byte from the stream, as this is required for fd passing to work on some implementations.

Since 2.22

cancellable

optional Gio.Cancellable object, null to ignore

Returns

a file descriptor on success, -1 on error.