memcpy moves too many bytes...should be: memcpy(&addr.sin_addr,he->h_addr,sizeof(addr.sin_addr));
memcpy moves too many bytes...should be: