Re: Multiple connections to dbus-daemon in single appication
dtdang <[email protected]>
| Newsgroups | gmane.comp.freedesktop.dbus |
|---|---|
| Message-ID | <CAJpUOaeRP4iT5SOtCjkX+++TLUA_x3mjB_JnOSwhow9PPSGrrg@mail.gmail.com> |
Hi Lawrence, Could you give any advises in detail ? In worst case, there is three commands sending to three different destination in parallel. I need to design server to adapt with that worst case. Thanks, On Tue, Sep 18, 2018 at 9:00 PM <[email protected]> wrote: > Send dbus mailing list submissions to > [email protected] > > 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 > [email protected] > > You can reach the person managing the list at > [email protected] > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of dbus digest..." > > > Today's Topics: > > 1. Re: dbus Digest, Vol 158, Issue 6 - Multiple connections to > dbus-daemon in single appication (dtdang) > 2. Re: Multiple connections to dbus-daemon in single appication > (Lawrence D'Oliveiro) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 18 Sep 2018 10:00:21 +0900 > From: dtdang <[email protected]> > To: [email protected] > Subject: Re: dbus Digest, Vol 158, Issue 6 - Multiple connections to > dbus-daemon in single appication > Message-ID: > <CAJpUOadFcJW3Z= > Nrtx1r0RcCZP3btKNwMJA_bWTHgo7jyebM8A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> > Content-Type: text/plain; charset="utf-8" > > 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 <[email protected]> > wrote: > > > Send dbus mailing list submissions to > > [email protected] > > > > 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 > > [email protected] > > > > You can reach the person managing the list at > > [email protected] > > > > 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 <[email protected]> > > To: [email protected] > > Subject: Multiple connections to dbus-daemon in single appication > > Message-ID: > > <CAJpUOadT=+scdTHV4xY6Zrmt18+_N4wHfLAZfjeMKyN=- > > [email protected]> > > 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-kC51rjc0cqs1dNLGKZg6taU/[email protected]> > > To: [email protected] > > Subject: Re: Multiple connections to dbus-daemon in single appication > > Message-ID: <20180917150311.07e9ddcf-QEjm8wl6P5m5/[email protected]> > > 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-ZGY8ohtN/[email protected]> > > To: [email protected] > > Subject: Re: Multiple connections to dbus-daemon in single appication > > Message-ID: <20180917114510.GA22202-KlMPWNVy2xGznp5rFuqWZquhQ75O6kbf0Fzj8UutsXo@public.gmane.org> > > 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 > > [email protected] > > 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-0001.html > > > > ------------------------------ > > Message: 2 > Date: Tue, 18 Sep 2018 13:22:51 +1200 > From: Lawrence D'Oliveiro <ldo-kC51rjc0cqs1dNLGKZg6taU/[email protected]> > To: [email protected] > Subject: Re: Multiple connections to dbus-daemon in single appication > Message-ID: <20180918132251.34490d17-QEjm8wl6P5m5/[email protected]> > Content-Type: text/plain; charset=US-ASCII > > On Tue, 18 Sep 2018 10:00:21 +0900, dtdang wrote: > > > 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. > > You can do all that on one connection. > > > ------------------------------ > > Subject: Digest Footer > > _______________________________________________ > dbus mailing list > [email protected] > https://lists.freedesktop.org/mailman/listinfo/dbus > > > ------------------------------ > > End of dbus Digest, Vol 158, Issue 7 > ************************************ > _______________________________________________ dbus mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dbus