System & Network Programming: Experiment 1
System & Network Programming: Experiment 1
Experiment 1
NETWORKING BASICS
• Iterative servers: This server knows ahead of time about how long it takes to
handle each request & server process handles each request itself.
Network Address: Network addresses give computers unique identities they can use to
communicate with each other. Specifically, IP addresses and MAC addresses are used
on most home and business networks.
Protocols: A Protocol is a convention or standard rules that enables and controls the
connection, communication and data transfer between two computing endpoints.
PORTS RANGE
Well-known ports 1-1023
Ephemeral ports 1024-5000
User-defined ports 5001-65535
The local process and foreign process are used to identify the specific processes on each
system that are involved in a connection. We also define Half association as either
{ protocol, local-address, local process} or { protocol, local-address, local process}
which specify each half of a connection. This half association is called a Socket or
transport address.
OSI Model
A common way to describe the layers in a network is to use the International Organization
for Standardization (ISO) open systems interconnection (OSI) model for computer
communications. This is a seven-layer model, which we show in Figure below along with
the approximate mapping to the Internet protocol suite.
We consider the bottom two layers of the OSI model as the device driver and networking
hardware that are supplied with the system. The network layer is handled by the IPv4
and IPv6 protocols. The transport layers that we can choose from are TCP and UDP
Layers in OSI model and Internet protocol suite.
The upper three layers of the OSI model are combined into a single layer called the
application. This is the Web client (browser) or whatever application we are using. With
the Internet protocols, there is rarely any distinction between the upper three layers of the
OSI model.
The sockets programming interfaces are interfaces from the upper three layers (the
"application") into the transport layer. The sockets provide the interface from the upper
three layers of the OSI model into the transport layer. There are two reasons for this
design:
• The upper three layers handle all the details of the application and know little about
the communication details. The lower four layers know little about the application,
but handle all the communication details: sending data, waiting for
acknowledgments, and so on.
• The second reason is that the upper three layers often form what is called a user
process while the lower four layers are normally provided as part of the operating
system (OS) kernel.
CLIENT-SERVER MODEL
Network applications can be divided into two process: a Client and a Server, with a
communication link joining the two processes.
Normally, from Client-side it is one-one connection. From the Server Side, it is many-one
connection.
The standard model for network applications is he Client-Server model. A Server is a
process that is waiting to be contacted by a Client process so that server can do
something for the client.
Typical BSD Sockets applications consist of two separate application level processes;
one process (the client) requests a connection and the other process (the server)
accepts it.
The server process creates a socket, binds an address to it, and sets up a mechanism
(called a listen queue) for receiving connection requests. The client process creates a
socket and requests a connection to the server process.
Once the server process accepts a client process's request and establishes a connection,
full-duplex (two-way) communication can occur between the two sockets.
Connection-less communication is related to the postal system. It does not include any
connection establishment and connection termination. Connection-less Service does not
give the guarantee of reliability. Connectionless communication there is no need to
establish connection between source (sender) and destination (receiver). But in
connection-oriented communication connection must established before data transfer.