various fixes

make proper use of err/errx
remove self-explanatory comments
use gethostbyname only once, not on each send
improve comments and error messages
coding conventions
check number of arguments at the very beginning
check for the right number of arguments