Archive for April, 2009
And there was much rejoicing:
[08:44] <alex___> YAY!
OK, there was some rejoicing anyway.
So, as discussed in the original bug, GResolver solves 4 problems for glib-based network apps:
- It provides an asynchronous DNS API (and also a synchronous-but-at-least-cancellable DNS API), so your UI doesn’t block while resolving hostnames. It even lets you do asynchronous lookups without using threads, through the magic of Lennart Poettering’s libasyncns (which has been sucked into the glib source tree à la xdgmime rather than being a new external dependency). (On Windows, async lookups-without-threads are done by using the Windows thread pool APIs, which are always available even if you aren’t using glib-level threads.)
- It handles IPv6 transparently, which is good for you
- It handles Internationalized Domain Names, which are also becoming increasingly popular. GResolver itself just transparently accepts either ASCII or UTF-8 names, but you can also explicitly convert back and forth between them with g_hostname_to_ascii() (to get a network-safe version) and g_hostname_to_unicode() (to get a user-friendly one).
- It does SRV record lookup, which is an important part of several protocols like XMPP (Jabber), but which is fairly annoying to do with the standard libc resolver APIs. The gresolver code includes an interface, GSocketConnectable, that abstracts around different ways of describing a network endpoint, so that it’s easy to write APIs that can accept either a hostname-and-port combo, or a SRV record description.
And of course, as suggested by the last point, GResolver is a building block of gnio, the gio-based network I/O library that Ryan Lortie and a few other people are working on, which will now also be making its way towards the glib mainline in time for GNOME 2.28, which will make your life even better than GResolver is already making it.
Now to finish porting libsoup to it…