### Class

# Gio DBusServer

since: 2.26

#### Description

    final class Gio.DBusServer : GObject.Object
      implements Gio.Initable {
      /* No available fields */
    }

`GDBusServer` is a helper for listening to and accepting D-Bus connections. This can be used to create a new D-Bus server, allowing two peers to use the D-Bus protocol for their own specialized communication. A server instance provided in this way will not perform message routing or implement the `org.freedesktop.DBus` interface.

To just export an object on a well-known name on a message bus, such as the session or system bus, you should instead use `g_bus_own_name()`.

An example of peer-to-peer communication with GDBus can be found in gdbus-example-peer.c.

Note that a minimal `GDBusServer` will accept connections from any peer. In many use-cases it will be necessary to add a `GDBusAuthObserver` that only accepts connections that have successfully authenticated as the same user that is running the `GDBusServer`. Since GLib 2.68 this can be achieved more simply by passing the `G_DBUS_SERVER_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER` flag to the server.

Available since: 2.26

#### Ancestors

- GObject

#### Implements

- GInitable

#### Constructors

###### g_dbus_server_new_sync

Creates a new D-Bus server that listens on the first address in `address` that works.

since: 2.26

#### Instance methods

###### g_dbus_server_get_client_address

Gets a D-Bus address string that can be used by clients to connect to `server`.

since: 2.26

###### g_dbus_server_get_flags

Gets the flags for `server`.

since: 2.26

###### g_dbus_server_get_guid

Gets the GUID for `server`, as provided to g_dbus_server_new_sync().

since: 2.26

###### g_dbus_server_is_active

Gets whether `server` is active.

since: 2.26

###### g_dbus_server_start

Starts `server`.

since: 2.26

###### g_dbus_server_stop

Stops `server`.

since: 2.26

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

##### Methods inherited from GInitable (1)

###### g_initable_init

Initializes the object implementing the interface.

since: 2.22

#### Properties

###### Gio.DBusServer:active

Whether the server is currently active.

since: 2.26

###### Gio.DBusServer:address

The D-Bus address to listen on.

since: 2.26

###### Gio.DBusServer:authentication-observer

A `GDBusAuthObserver` object to assist in the authentication process or `NULL`.

since: 2.26

###### Gio.DBusServer:client-address

The D-Bus address that clients can use.

since: 2.26

###### Gio.DBusServer:flags

Flags from the `GDBusServerFlags` enumeration.

since: 2.26

###### Gio.DBusServer:guid

The GUID of the server.

since: 2.26

#### Signals

###### Gio.DBusServer::new-connection

Emitted when a new authenticated connection has been made. Use `g_dbus_connection_get_peer_credentials()` to figure out what identity (if any), was authenticated.

since: 2.26

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

since: 2.0