tres

Update of "tres"
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

Artifact ID: 515be57177ece77fe0e3cea17b9f5a207aa97cc0
Page Name:tres
Date: 2015-03-11 05:10:34
Original User: aspect
Parent: e4af0da0f3fad30216caa700e2f5fc3edcfaa31f
Content

tres is a featherweight threaded resolver for POSIX. It currently consists of a single stand-alone test program that takes hosts to resolve on the command line and on stdin, echoing the results back on stdout.

It has been tested on Linux+gcc and FreeBSD+clang (and OpenBSD+whatever that uses, though the `Makefile`'s apparently GNU-specific), and I'm fairly confident it should work in other POSIX environments. Unfortunately, the test harness isn't terribly scriptable without either a ares_wait() method or more smarts in the test program. The latter is more appealing, as the former requires much more smarts in my dumb dispatcher and will push past the 500loc and almost braindead ignorance of most of the pthread API.

The goal is eventually to adapt this to Tcl_Thread such that it can be applied to the Tcl core and make asynchronous sockets truly asynchronous. There are a few bridges to cross first, and this isn't a high-priority project for me, so don't hold your breath.

Testing

Just make to build the executable ares. Run it with 0 or more hostnames to resolve on the command line. You can give more hostnames on stdin (one per line) to get those resolved too.

An empty line on stdin will cause it to prune unused resolver threads. EOF will cause it to exit.

Hosts are resolved asynchronously, so output can be interleaved. Output for a single resolution looks something like:

request 'csiro.au'
result 'csiro.au' = '150.229.76.170'
result 'csiro.au' = '150.229.12.170'
result 'csiro.au' = '2405:b000:e00:280::12:170'
result 'csiro.au' = '2405:b000:b00:280::76:170'
result 'csiro.au' = ''

Useful hostnames for testing

Of course, some of these are allowed to change at the site administrator's whim.

Shout-outs

Stu's Treso and Netinfo deserve examination on the way to Tclification. Thanks Stu for testing on OpenBSD, and RKeene for being an all-round good guy.