Gio.Socket.new_from_fd

function new_from_fd(fd: Number(gint)): Gio.Socket {
    // Gjs wrapper for g_socket_new_from_fd()
}
  

Creates a new Gio.Socket from a native file descriptor or winsock SOCKET handle.

This reads all the settings from the file descriptor so that all properties should work. Note that the file descriptor will be set to non-blocking mode, independent on the blocking mode of the Gio.Socket.

Since 2.22

fd

a native socket file descriptor.

Returns

a Gio.Socket or null on error. Free the returned object with GObject.Object.prototype.unref.