seg fault fixed with now correct use of hostinfo->h_addr, hostinfo->h_length