Home > Articles > Programming > Java

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

Exercises

  1. Extend the previous example mail program so that it prompts for user input and generally provides a friendly front end to sending mail.

  2. Write a socket server program that simply returns the time on the current system. Write a client that calls the server and sends you mail to report on how far apart the time on the local system is versus the time on the current system.

  3. In the previous exercise, the server can only state what time it is at the instant the request reaches it, but that answer will take a certain amount of time to travel back to the client. Devise a strategy to minimize or correct for errors due to transmission time. (Hard—use a heuristic to make a good guess.)

  4. Read the API for java.net.URLEncoder and URLDecoder and write a program that encodes a string into the MIME format called x-www-form-urlencoded.

  5. Update the multithreaded webserver so that it can also serve JPG and GIF files and correctly identify their type to the browser. You can just use the file extension as an indicator of the contents.

  • + Share This
  • 🔖 Save To Your Account