client receivedb"echo=> 'blue,at sat apr : : client receivedb"echo=> 'noat sat apr : : client receivedb"echo=> 'yellow!at sat apr : : now that we have handle on the basic modellet' move on to the tricky bits this server script is fairly straightforward as forking code goesbut few words about the library tools it employs are in order forked processes and sockets we met os fork in but recall that forked processes are essentially copy of the process that forks themand so they inherit file and socket descriptors from their parent process as resultthe new child process that runs the handleclient function has access to the connection socket created in the parent process reallythis is why the child process works at all--when conversing on the connected socketit' using the same socket that parent' accept call returns programs know they are in forked child process if the fork call returns otherwisethe original parent process gets back the new child' id exiting from children in earlier fork exampleschild processes usually call one of the exec variants to start new program in the child process hereinsteadthe child process simply calls function in the same program and exits with os _exit it' imperative to call os _exit here-if we did noteach child would live on after handleclient returnsand compete for accepting new client requests in factwithout the exit callwe' wind up with as many perpetual server processes as requests served--remove the exit call and do ps shell command after running few clientsand you'll see what mean with the callonly the single parent process listens for new requests os _exit is like sys exitbut it exits the calling process immediately without cleanup actions it' normally used only in child processesand sys exit is used everywhere else killing the zombiesdon' fear the reapernotehoweverthat it' not quite enough to make sure that child processes exit and die on systems like linuxthough not on cygwinparents must also be sure to issue wait system call to remove the entries for dead child processes from the system' process table if we don' do thisthe child processes will no longer runbut they will consume an entry in the system process table for long-running serversthese bogus entries may become problematic it' common to call such dead-but-listed child processes zombiesthey continue to use system resources even though they've already passed over to the great operating system beyond to clean up after child processes are gonethis server keeps listhandling multiple clients