On Mon, Jun 17, 2013 at 1:38 AM, Emmanuele Bassi <eba...@gmail.com> wrote:
> hi;
>
> On 16 June 2013 17:24, Andrea Zagli <aza...@libero.it> wrote:
>> is there a way to send a gobject from a server to a client via network (ex.
>> via http or other protocol)?
>>
>> i want to create a gobject in a daemon in a server and pass it to a client
>
> if you're doing in on the same machine, then you can use DBus and the
> GDBus facilities in GIO. [0]

Also, note that GDBus does not have any requirement for usage on the
same system.

I've found gdbus-codegen to produce a very nice API, and you can use
GDBusServer directly for the server side, and export a generated
GDBusInterfaceSkeleton on any incoming client connections (clients
can also export interfaces directly onto connections which they've made
to the remote GDBusServer).

I've also found it to be quite practical to use the Avahi service discovery
library to share GDBus objects on a LAN (just tell Avahi to advertise the
tcp ip address reported by g_dbus_server_get_client_address(), and have
your clients connect to an ip/port discovered by Avahi).

Cheers,
    -Tristan

>
> if you want to just send an object representing state from one process
> on one machine, to another process on another machine, you can
> serialize the instance on the server and deserialize it on the client;
> you can use whatever interchange format you want — I have a soft spot
> for JSON, so you can check out JSON-GLib, which has facilities for the
> serialization/deserialization passes. [1]
>
> if you want to invoke methods, on the other hand, you may want to have
> a look at an RPC system, like the XML-RPC API exposed by LibSoup. [2]
>
> ciao,
>  Emmanuele.
>
> [0] https://developer.gnome.org/gio/stable/gdbus-convenience.html
> [1] 
> https://developer.gnome.org/json-glib/0.16/json-glib-GObject-Serialization.html
> [2] https://developer.gnome.org/libsoup/stable/libsoup-2.4-XMLRPC-Support.html
>
> --
> W: http://www.emmanuelebassi.name
> B: http://blogs.gnome.org/ebassi/
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to