/* README.txt for multiserver example */ We have here a TCP concurrent server that forks a new child to handle each new user connection. The maximum number of concurrent children is MAXCHILD (default is 5). Each child is given a socket to communicate with the client and a file name. The file name is of an executable image that the child will execute after a setup phase. In the setup the child sets timeouts on the socket and redirects to the socket both its standard input and output. The main program of the server is created with the command % gcc -o multiserver multiserver.c and is invoked with the command % multiserver [port [filename]] where port:protocol port number to use filename: image to execute in child The port argument is optional. If no protocol port is specified, the server uses the default given by PROTOPORT (default is 5194) and the same for filename (default is "child"). The main program, after setting up a listening socket, in a loop accepts connections from clients. When a connection is made, and a connected socket is obtained, a child process is forked. It will behave as indicated above. The default executable image is obtained with the command % gcc -o child child.c child.c is a program that in a loop echoes to standard output all it receives from standard input.