X-Git-Url: https://gapil.gnulinux.it/gitweb/?a=blobdiff_plain;f=listati%2FTCP_echod_third.c;fp=listati%2FTCP_echod_third.c;h=c150ad473bbe97b7ad3df992cf222c95016b95da;hb=8654ce33b450ae7bb34c3907835000a0760c2931;hp=0000000000000000000000000000000000000000;hpb=88d8a251947f948094d35de596feaf49e975f91b;p=gapil.git diff --git a/listati/TCP_echod_third.c b/listati/TCP_echod_third.c new file mode 100644 index 0000000..c150ad4 --- /dev/null +++ b/listati/TCP_echod_third.c @@ -0,0 +1,20 @@ +int main(int argc, char *argv[]) +{ +/* + * Variables definition + */ + int list_fd, conn_fd; + ... + /* Main code begin here */ + if (compat) { /* install signal handler */ + Signal(SIGCHLD, HandSigCHLD); /* non restarting handler */ + } else { + 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"); + return 1; + } + ... +}