Server rewrite - Before the rewrite int s; struct sockaddr_in sin; s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); memset(&sin, 0, sizeof(sin)); sin.sin_family = AF_INET; sin.sin_len = sizeof(sin); sin.sin_port = htons(80); if (bind(s, &sin, sizeof(sin)) < 0) exit(1); listen(s, 5);