Le vendredi 27 juin 2008 à 11:45 +0200, Yann Leboulanger a écrit :
> Tomas Karasek wrote:
> > What I'm looking for is either
> >  - some elegant way how to do both A and AAAA requests asynchronously
> >    (like nonblocking getaddrinfo) which would be a nice solution
> > or
> >  - nonblocking detect that network is down which would allow to avoid
> >    needless call of getaddrinfo (temporary solution until some
> > suitable        library appears)
> > 
> > Do you have any ideas/suggestions on this?
> > 
> Another solution is to create python bindings for libasyncns:
> http://0pointer.de/lennart/projects/libasyncns/

Hello everyone,

After reading Tomas Karasek's mail, I found libasyncns too.

This afternoon, I hacked a python binding while I was on a train (and
some hours after that), and I'm now able to use libasyncns from python.

Currently, it's not very clean (currently it's a first draft), it's
using swig (so we can see some "garbage" from python, like wrappers, but
it has some interesting features too).

Anyway, I'm able to do the same things than the "asyncns-test.c" file
from the libasyncns' documentation [1] (but in ~25 lines instead of
~125) (see the file asyncns-test.py).

I'm joining the code with this mail, if someone is interested. For
example, it may be used to test how gajim may work with libasyncns
someday (but I don't know what gajim needs).
(I didn't put licensing information already but it's LGPL2+, like the
libasyncns library)

Keep in mind that this is a work in progress, currently:
 - exceptions should work
 - IPv6 isn't available in getnameinfo
 - I don't store values from requests so I can't use a query object
 - some functions are not implemented:
      asyncns_getnext(), asyncns_getnqueries(), asyncns_getuserdata(),
      asyncns_setuserdata(), asyncns_res_search(), asyncns_fd()...
 - this is not deeply tested, and for example I don't know how memory is


Damien Thebault

Key C15AB8AF
Fingerprint 8FB9 8576 7033 4B45 3DF5  88E8 5471 1A44 C15A B8AF

Attachment: libasyncns-python-1.tar.bz2
Description: application/bzip-compressed-tar

Attachment: signature.asc
Description: Ceci est une partie de message numériquement signée

Gajim-devel mailing list

Reply via email to