Client rewrite - Before the rewrite struct hostent *hp; int i, s; struct sockaddr_in sin; s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); hp = gethostbyname("www.kame.net"); for (i = 0; hp->h_addr_list[i]; i++) { memset(&sin, 0, sizeof(sin)); sin.sin_family = AF_INET; sin.sin_len = sizeof(sin); sin.sin_port = htons(80); memcpy(&sin.sin_addr, hp->h_addr_list[i], hp->h_length); if (connect(s, &sin, sizeof(sin)) < 0) continue; break; }