dbus Digest, Vol 158, Issue 6 - Multiple connections to dbus-daemon in single appication
dtdang
ddt.fet.hut at gmail.com
Tue Sep 18 01:00:21 UTC 2018
Many thanks Lawrence & Simon,
But you might misunderstand my point.
I would like to register in three separated connections since client will
send command with option (like using dbus-send with
option --dest=com.app.bluetooth or --dest=com.ap.wifi or --dest=com.ap.ap).
So I want to open three separated connection with specific name in three
threads to listen from client. It mean that my process will try to
open/register 3 separated DBUS connections to dbus-daemon so that whatever
being sent by client (regardless of any --dest option) will be proceeded
by my server application.
So is it possible that an application can register multiple separated
dbus-connections to dbus-daemon ? Three separated dbus connections should
operate independently.
You are right about I am not owning app.com or ap.com. It just my example.
Many thanks for correcting it.
On Mon, Sep 17, 2018 at 9:00 PM <dbus-request at lists.freedesktop.org> wrote:
> Send dbus mailing list submissions to
> dbus at lists.freedesktop.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.freedesktop.org/mailman/listinfo/dbus
> or, via email, send a message with subject or body 'help' to
> dbus-request at lists.freedesktop.org
>
> You can reach the person managing the list at
> dbus-owner at lists.freedesktop.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of dbus digest..."
>
>
> Today's Topics:
>
> 1. Multiple connections to dbus-daemon in single appication (dtdang)
> 2. Re: Multiple connections to dbus-daemon in single appication
> (Lawrence D'Oliveiro)
> 3. Re: Multiple connections to dbus-daemon in single appication
> (Simon McVittie)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 17 Sep 2018 11:30:52 +0900
> From: dtdang <ddt.fet.hut at gmail.com>
> To: dbus at lists.freedesktop.org
> Subject: Multiple connections to dbus-daemon in single appication
> Message-ID:
> <CAJpUOadT=+scdTHV4xY6Zrmt18+_N4wHfLAZfjeMKyN=-
> oFnDA at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Dear all,
>
> Is it possible to create multiple connections by using "dbus_bus_get" &
> "dbus_bus_request_name" inside a single server to listen from multiple
> client ?
> For instance, I just want to register three connections to dbus-daemon as
> bellows in a single application.
>
> com.app.bluetooth
> com.ap.wifi
> com.ap.ap
>
> Thanks,
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> https://lists.freedesktop.org/archives/dbus/attachments/20180917/cc7ee0a9/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 2
> Date: Mon, 17 Sep 2018 15:03:11 +1200
> From: Lawrence D'Oliveiro <ldo at geek-central.gen.nz>
> To: dbus at lists.freedesktop.org
> Subject: Re: Multiple connections to dbus-daemon in single appication
> Message-ID: <20180917150311.07e9ddcf at theon.geek-central.gen.nz>
> Content-Type: text/plain; charset=US-ASCII
>
> On Mon, 17 Sep 2018 11:30:52 +0900, dtdang wrote:
>
> > Is it possible to create multiple connections by using "dbus_bus_get"
> > & "dbus_bus_request_name" inside a single server to listen from
> > multiple client ?
> > For instance, I just want to register three connections to
> > dbus-daemon as bellows in a single application.
> >
> > com.app.bluetooth
> > com.ap.wifi
> > com.ap.ap
>
> You can register multiple bus names on a single connection.
>
>
> ------------------------------
>
> Message: 3
> Date: Mon, 17 Sep 2018 12:45:10 +0100
> From: Simon McVittie <smcv at collabora.com>
> To: dbus at lists.freedesktop.org
> Subject: Re: Multiple connections to dbus-daemon in single appication
> Message-ID: <20180917114510.GA22202 at archetype.pseudorandom.co.uk>
> Content-Type: text/plain; charset=us-ascii
>
> On Mon, 17 Sep 2018 at 11:30:52 +0900, dtdang wrote:
> > Is it possible to create multiple connections by using "dbus_bus_get" &
> > "dbus_bus_request_name" inside a single server to listen from multiple
> client ?
>
> You seem to be mixing up connections with well-known bus names.
>
> As Lawrence D'Oliveiro said in a previous reply, you can register
> multiple well-known bus names on the same connection by calling
> dbus_bus_request_name() several times on the same DBusConnection. If you
> want multiple well-known bus names, 95% of the time this is the right
> thing to do.
>
> You can also open multiple connections, each of which can own any number
> of well-known names, by calling dbus_bus_get_private() several times to
> get several distinct DBusConnection objects. This is usually the wrong
> thing to do, but is an option if you have specialized requirements.
> If you do this, beware that there are no ordering guarantees between
> different DBusConnection objects: if two messages A and B are sent,
> then one DBusConnection might see both A and B before a second
> DBusConnection has seen A.
>
> Consider using a more user-friendly (and thread-safe) D-Bus implementation
> such as GLib's GDBus. The reference implementation, libdbus, has this
> statement on the first page of its documentation:
>
> This manual documents the *low-level* D-Bus C API. **If you use
> this low-level API directly, you're signing up for some pain.**
>
> In GDBus, the equivalent of dbus_bus_get() is g_bus_get()
> or g_bus_get_sync(), the equivalent of DBusConnection is
> GDBusConnection, the equivalent of dbus_bus_request_name() is
> g_bus_own_name_on_connection(), and the closest equivalent for
> g_bus_get_private() is g_dbus_connection_new_for_address[_sync]()
> with the G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT and
> G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION flags. Similar comments
> apply about the ability to own more than one well-known name per
> GDBusConnection.
>
> > com.app.bluetooth
> > com.ap.wifi
> > com.ap.ap
>
> I suspect you don't own app.com (owned by Gannett Media Technologies
> International, according to whois) and ap.com (owned by Audio Precision,
> according to web page content). Please choose a namespace starting with
> a reversed domain name that your organisation controls.
>
> smcv
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dbus
>
>
> ------------------------------
>
> End of dbus Digest, Vol 158, Issue 6
> ************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dbus/attachments/20180918/d3d48945/attachment.html>
More information about the dbus
mailing list