Skip to content
On this page

Network Programming

Introduction

Process commmunication

A process is a program in execution

In your computer, processes may talk with each other by inter-process communication (IPC). IPC methods include

  • File locking
  • Pipes
  • FIFO
  • Message queues
  • Semaphores
  • Shared memory

Processes may be also executed on different systems. From the viewpoint of each process, this is till IPC.

figure-1

Image credit to Professor Wang's slides

Layering architecture

In the 7-layer model, each layer is responsible for different tasks.

LayerTask
ApplicationTo allow access to network resources
PresentationTo translate, encrypt, and compress data
SessionTo establish, manage, and terminate sessions
TransportTo provide reliable process-to-process message delivery and error recovery
NetworkTo move packets from source to destination; to provide internetworking
Data linkTo organize bits into frames; to provide hop-to-hop delivery
PhysicalTo transmit bits over a medium; to provide mechanical and electrical specifications

Data encapsulation

The data portion of a packet at level carries the whole packet from level (while the header portion is for level itself)

figure-2

Image credit to Professor Wang's slides

P2P vs. client-server

Network communications can be classified into two types:

Peer-to-peer (P2P)

Data may be distributed over all computer. A common example is torrenting in which data is segmented into small parts and distributed all over the user end systems. However, we still need a server to coordinate between endpoints, otherwise, we cannot find at which IP addresses the data exist.

Client-server architecture

Data may be concentrated on few sites, i.e., servers. And other computers, i.e., clients, may obtain their desired dat aby querying these sites.