It is possible for a programmer to create network applications that operate across the global Internet without understanding how networks operate or how the underlying technologies carry the data between computers. The programmer must be given a set of high-level functions that form an Application program Interface (API). This chapter presented a network ApI that contains only seven primitives, and reviewed example applications that show the API is sufficient to construct software that corTectly interoperates with commercial software.
3. 1 The echo service is a standasigned application number 7. see if they run a standard echo server.
3. 2 Modify the echo server so that instead of exiting after it handles one client, the server waits for another client. Hint : look at the web server.
3. 3 0ur chat software requires the users to take turns entering text. Rewrite the software to allow either user to type an arbitrary number of lines at any time. Hint : use threads.
3. 4 Modify the chat client to send a user name with each message, and modify the server to identify a user when displaying a line of output.
3. 5 Extend the above exercise so that instead of sending the user name with each message, the chat client and server exchange user names when they first make contact.
3. 6 Why does the example code use a mixture of calls to write and various forms of prinrf? Hint : does Windows treat sockets, files, and pipes identically?
3. 7 Devise software that permits an n-way chat session that allows users to join and leave the session at any time.
3. 8 Try the web client program with well-known lnternet web servers. To do so, give the server’s name, a path of index. Html or index. Htm, and application number 80.
3. 9 Add another”page”to the web server.
3. 10 Modify the web server so it extracts the contents of each page from a file instead of having them hard-wired into the code.
3. 11 Expand the previous exercise to recognize file names that end in. Gif and send them using a Colztent-i)pe header with a value imageTgif instead of the string textlJztml.
3. 12 (advanced) Implement the Common Gateway Interface (CGI) from the specification found at http :// hoohoo. ncsa. uiuc. edu/cgi/
3. 13 (advanced) Extend the web server so it can handle multiple connections concurTently. Hint usefork or ptbread_create. ird service available throughout the Internet. It has been as Use the echo client to test computers in your organization to