From 5138fe9a4c69d3c4aa45d13c12ca9b7dfb6d5643 Mon Sep 17 00:00:00 2001 From: nbillard Date: Mon, 13 Feb 2023 09:38:24 +0100 Subject: [PATCH] distinction between father and son --- tsock_v4.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tsock_v4.c b/tsock_v4.c index a6058af..292218d 100644 --- a/tsock_v4.c +++ b/tsock_v4.c @@ -392,7 +392,7 @@ int main (int argc, char **argv) { exit(1); } - while (1) { + while (sock != 0) { //acceptation d'une demande de connexion if((sock_bis=accept(sock,(struct sockaddr *)&adr_em, &lg_adr_em)) == -1) { @@ -409,6 +409,7 @@ int main (int argc, char **argv) { break; case 0: close(sock); + sock = 0; if (source == 1) { //envoi for(i=0; i