[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ocaml-dns

On 18 Mar 2013, at 11:03, Richard Mortier <Richard.Mortier@xxxxxxxxxxxxxxxx> 

> hi anastasia;
> On 18 Mar 2013, at 03:45, Anastasia Gornostaeva wrote:
>> It seems Dns does not provide any way to connect to DNS server and resolve
>> any queries. Am I wrong?
>> I've found Dns_resolver for using with lwt, but it absents by default (even 
>> in
>> opam installation). Should I re-implement Dns_resolver for plain networking?
> we use Lwt for the networking here, so we never did one for "plain 
> networking". when you say "absents by default", what do you mean? if you have 
> the necessary libraries installed, do a "make distclean" and then "make" it 
> should cause the oasis setup to run with --enable-tests and --enable-lwt 
> which causes mldig to be built, giving a simple command line client. let me 
> know if it doesn't work.
> (fwiw using 4.00.1 system compiler on osx, i had to "opam install cstruct re 
> lwt cmdliner cryptokit uri" before i got a build working; but it did work 
> once i installed those libs.)

Lwt is an optional dependency, so it should work with 'opam install lwt dns'.  
Mort's example above is required to satisfy the build dependencies, whereas my 
line will just install the DNS library.

> really, the thing to do would be to follow the pattern that's being taken 
> with cohttp -- see eg., https://github.com/yallop/ocaml-cohttp. that is, 
> create a client monad that abstracts over specific backends (Lwt, Core, etc) 
> and can encapsulate the (somewhat complex) logic that a DNS client has to 
> implement. this would go into the lib/ directory, and there would then be 
> specific client instantiations client_lwt/ client_core/ and so on.

Yeah. There's a non-trivial amount of logic in a client resolver (iterative, 
recursive, timeouts, etc), and it would be great to factor that out across Lwt 
and Async.

Anastasia, are you using Lwt in your code, or native Unix IO?  If the latter, 
we'll need to add a new backend for that (presumably using threads to block?)




Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.