2012/9/13 Jasper St. Pierre <jstpie...@mecheye.net>: > On Thu, Sep 13, 2012 at 2:04 PM, Giovanni Campagna > <scampa.giova...@gmail.com> wrote: >> 2012/9/13 Baptiste Saleil <baptiste.sal...@gmail.com>: >>> Hi all. >>> >>> Just a simple question : >>> I'm writing an extension for the shell. >>> So, what's the best way to communicate over TCP/IP with this extension ? >> >> Have a look at Gio: http://library.gnome.org/devel/gio/unstable/ >> It includes GSocket, wrapping the low-level BSD sockets, and higher >> level wrappers such as GSocketClient and GSocketConnection. >> Once you have that, you can get a GSocketInputStream / >> GSocketOutputStream, wrap it with a GDataInputStream / >> GDataOutputStream for buffering and formatting. >> If you're doing binary communications, you probably need to target >> 3.6, as many operations did not support GBytes in 3.4. > > That's not quite true. We enable binary strings, and gjs had > "byteArray" since forever.
Yes, but you need the right annotations for that to work. Looking at what's in the latest unstable GIO: - only the GBytes variants of GInputStream are introspectable, the binary array versions are useless - GPollableInputStream is useful only for the GSource (but you can't get the parameters passed to the GSource function), nonblocking read doesn't work - g_buffered_input_stream_peek has annotations, but they're wrong, because they require you to pass an array into which to write (and then the results are discarded, because the array is an in parameter) Plus byteArray is used only with GByteArray (so never really), and binary arrays are arrays of doubles, so I'd recommend against using them for big binary blobs. Giovanni _______________________________________________ gnome-shell-list mailing list gnome-shell-list@gnome.org https://mail.gnome.org/mailman/listinfo/gnome-shell-list