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