Aggiunte note per le funzioni classiche dei socket per ricordarne il loro
[gapil.git] / sources / TCP_echod.c
index fd51f982797a745c6d5d2f1e8fc1cf3c5949b45d..dd0a9f855b3f2cb5d8295c431732c5ac36e86c5e 100644 (file)
@@ -26,7 +26,7 @@
  *
  * Usage: echod -h give all info
  *
- * $Id: TCP_echod.c,v 1.12 2003/08/03 18:12:47 piccardi Exp $ 
+ * $Id: TCP_echod.c,v 1.13 2003/12/25 17:31:09 piccardi Exp $ 
  *
  ****************************************************************/
 /* 
@@ -42,6 +42,8 @@
 #include <signal.h>      /* signal functions */
 #include <errno.h>       /* error code */
 #include <string.h>      /* error strings */
+#include <stdlib.h>
+
 #include "Gapil.h"
 
 #define BACKLOG 10
@@ -153,9 +155,10 @@ int main(int argc, char *argv[])
     /* handle echo to client */
     while (1) {
        /* accept connection */
+       len = sizeof(cli_add);
        while (((conn_fd = accept(list_fd, (struct sockaddr *)&cli_add, &len)) 
                < 0) && (errno == EINTR)); 
-       if ( conn_fd < 0) {
+       if (conn_fd < 0) {
            PrintErr("accept error");
            exit(1);
        }