Java for Network Programming
(based on material from Java for Students by Bell and Parr)

Network programming is all about making a program running on one computer talk to a program running on another computer.

The Java library package java.net provides lots of useful classes and methods for networking. For example, the class InetAddress handles Internet addresses, both as host names and as IP addresses. The OO approach in designing the Java library classes is to model each internet concept as a class. So, the important classes are InetAddress, URL, Socket. We will look at these in turn.


Topics:

  1. Section 1 - Basic Internet Principles
  2. Section 2 - The HTTP Protocol
  3. Section 3 - Processing Internet Addresses
  4. Section 4 - Programming Using URLs
  5. Section 5 - Programming Clients Using Sockets
  6. Section 6 - Programming Servers Using Sockets
  7. Section 7 - Bibliography


To understand the network Java programs discussed here, you need to understand:

  1. The general pattern for an application
  2. Creating new objects from library classes
  3. The Java event-handling model
  4. Creating a GUI interface
  5. Handling exceptions
  6. Using streams
  7. Multi-threading


All the programs are applications (not applets) because they need the privilege to access the network and remote computers.


These notes have been adapted from a supplementary book chapter by Douglas Bell and Mike Parr, and modified to fit local conditions.