X-Git-Url: https://gapil.gnulinux.it/gitweb/?p=gapil.git;a=blobdiff_plain;f=sources%2FTCP_echod_second.c;h=0ac7c0ef072a15dcedf5dc9d6d701bdabbce0462;hp=4519b29e3d3e3e63e3e18dd60448ff095dc0e119;hb=8654ce33b450ae7bb34c3907835000a0760c2931;hpb=28ac8648240edd35e31f75ae11dbe3e4ac9e109e diff --git a/sources/TCP_echod_second.c b/sources/TCP_echod_second.c index 4519b29..0ac7c0e 100644 --- a/sources/TCP_echod_second.c +++ b/sources/TCP_echod_second.c @@ -1,4 +1,4 @@ -/* TCP_echod.c +/* TCP_echod_second.c * * Copyright (C) 2001-2003 Simone Piccardi * @@ -20,13 +20,14 @@ * * Program echod * Elementary TCP server for echo service (port 7) + * Second version * * Author: Simone Piccardi * Jun. 2001 * * Usage: echod -h give all info * - * $Id: TCP_echod_second.c,v 1.1 2003/08/03 18:12:47 piccardi Exp $ + * $Id$ * ****************************************************************/ /* @@ -42,6 +43,8 @@ #include /* signal functions */ #include /* error code */ #include /* error strings */ +#include + #include "Gapil.h" #define BACKLOG 10 @@ -153,9 +156,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); }