X-Git-Url: https://gapil.gnulinux.it/gitweb/?p=gapil.git;a=blobdiff_plain;f=sources%2FTCP_echod_third.c;h=a0ed4f9d9b5e0bedb508b881d397cbc2a154019b;hp=86c154fd947226bc75ab0714ccdce0ae4ae36605;hb=d451ac30382ae398b9a2242a4f82b3438affc8a7;hpb=8654ce33b450ae7bb34c3907835000a0760c2931 diff --git a/sources/TCP_echod_third.c b/sources/TCP_echod_third.c index 86c154f..a0ed4f9 100644 --- a/sources/TCP_echod_third.c +++ b/sources/TCP_echod_third.c @@ -20,30 +20,28 @@ * * Program echod * Elementary TCP server for echo service (port 7) - * Third version, use sockbind + * Third version * * Author: Simone Piccardi * Jun. 2001 * * Usage: echod -h give all info * - * $Id$ - * ****************************************************************/ /* * Include needed headers */ -#include /* predefined types */ -#include /* include unix standard library */ -#include /* IP addresses conversion utiliites */ -#include /* socket library */ -#include /* include standard I/O library */ -#include +#include /* primitive system data types */ +#include /* unix standard library */ +#include /* IP addresses conversion utilities */ +#include /* socket constants, types and functions */ +#include /* standard I/O library */ +#include /* date and time constants, types and functions */ #include /* syslog system functions */ -#include /* signal functions */ -#include /* error code */ -#include /* error strings */ -#include +#include /* signal constants, types and functions */ +#include /* error definitions and routines */ +#include /* C strings library */ +#include /* C standard library */ #include "Gapil.h" @@ -117,8 +115,7 @@ int main(int argc, char *argv[]) SignalRestart(SIGCHLD, HandSigCHLD); /* restarting handler */ } /* create and bind socket */ - if ( (list_fd = sockbind(argv[optind], "echo", 6, SOCK_STREAM)) < 0) { - if (errno) perror("Socket creation error"); + if ( (list_fd = sockbind(NULL, "echo", 6, SOCK_STREAM)) < 0) { return 1; } /* release privileges and go daemon */