Team-FLY |
A tunnel is a blind relay that ceases to exist when both ends of a connection are closed. The passmonitor program of Section 19.5 is technically not a tunnel because it resumes listening for another connection request after closing its connections to the client and the destination server. It acts as a server for the tunnel function. One limitation of passmonitor is that it handles only one communication at a time. Modify the passmonitor program of Section 19.5 to fork a child to handle the communication. The child should call the tunnel function and print to standard output a message containing the total number of bytes written. Call the new program tunnelserver . The parent, which you can base on Program 18.2 on page 623, should clean up zombies by calling waitpid with the WNOHANG option and resume listening for additional requests . Exercise 19.19How would you start tunnelserver on port 15002 to service the web server www.usp.cs.utsa.edu running on port 8080 instead of port 80? Answer: tunnelserver 15002 www.usp.cs.utsa.edu 8080 Exercise 19.20Why can't the child process of tunnelserver return the total number of bytes processed to the parent process in its return value? Answer: Only 8 bits of the process return value can be stored in the status value from wait . |
Team-FLY |