Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

60.7. Exercises

  1. Add code to the program in Example 60-4 (is_echo_sv.c) to place a limit on the number of simultaneously executing children.

  2. Sometimes, it may be necessary to write a socket server so that it can be invoked either directly from the command line or indirectly via inetd. In this case, a command-line option is used to distinguish the two cases. Modify the program in Example 60-4 so that, if it is given a -i command-line option, it assumes that it is being invoked by inetd and handles a single client on the connected socket, which inetd supplies via STDIN_FILENO. If the -i option is not supplied, then the program can assume it is being invoked from the command line, and operate in the usual fashion. (This change requires only the addition of a few lines of code.) Modify /etc/inetd.conf to invoke this program for the echo service.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint