Correctly bind socket to UDP port

Improved application to process a single signal: `TERM`. The currect
implementation is not thread-safe: each dnsd instance within the process
will attempt to install it's own `TERM` signal handler, without calling
the previous one.

This is fine for now but might require a different implementation if
this is ever used in-process with something else that requires handling
the `TERM` signal.