Unit 4. Network programming


We have already studied how independent applications can collaborate to do a task (multiprocess) or just how to divide a program in many execution threads to be run simultaneously and even concurrently (multithread). But all this happens inside one computer, it can be monoprocessor or multiprocessor, under the same OS and sharing memory and I/O.

In this unit we are going one step forward, we are going to code applications working on distributed environments. Once again we will have multiple processes running, but instead having a parent-child (launcher-launched) relationship, now the processes will be run on independent systems, and what's more interesting, the will communicate through the network by using communication protocols.

Basically we can classify distributed systems in two groups::

  • Client / Server: where one process, called the server, offers services to one or more processes, called clients.
  • Peer to peer (P2P): where all the processes collaborate in a similar way without any particular specialization or difference among them.

Processes and Threads

To make a distributed application, with processes and network communication, we are not starting form the scratch.

Network programming is strongly linked with multiprocess programming. We will see how communication between process is exactly the same as through the network.

On the other side, the specialization and service offered by a server, simultaneously to many clients, is based on the multithread approach..

All the above, all concepts and knowledge acquired from unit 1 to unit 3, will be the scaffold to start creating distributed applications.

Goals

The goals for this unit are:

  • To know about TCP/IP protocol, addresses used in each protocol layer and associated protocols.
  • To know Java classes tp work with Internet addresses and server names.
  • To learn about basic TPC and UPD protocols features.
  • To code applications that use TCP protocol for communication purposes.
  • To code applications that use UDP protocol for communication purposes.
  • To design and code protocols for distributed applications.
  • to coordinate multiple client access to servers by using multithread programming.
Last updated:
Contributors: Vicente Martínez