minor fixes
now using getaddrinfo()
added comments