Print "Server started" after calling listen(), or there wil be a race
where the client tries to connect before there is a listen queue and
gets ECONNREFUSED.
com_err("uu-server", errno, "binding socket");
exit(3);
}
-
- printf("Server started\n");
- fflush(stdout);
-
if (listen(sock, 1) == -1) {
com_err("uu-server", errno, "listening");
exit(3);
}
+
+ printf("Server started\n");
+ fflush(stdout);
+
if ((acc = accept(sock, (struct sockaddr *)&f_inaddr, &namelen)) == -1) {
com_err("uu-server", errno, "accepting");
exit(3);