fix endian problem for 127.0.0.1 resolves and also make both to_addr inputs network byte order
int => size_t