So let me simplify the code I'm working on:
int fd = socket(...);
int client = accept(fd, ...);
while (true) {
int bytes_read = recv(client, ...);
if (bytes_read == 0) {
break;
}
};
At this point I already know that the client is disconnected (recv
returned 0). But do I still have to call
close(client);
?