0% found this document useful (0 votes)
40 views

Lecture 5 Computer Networks

This document provides an overview of the application layer in computer networks. It discusses two main paradigms at the application layer: client-server and peer-to-peer. In client-server, a client initiates communication by requesting services from a server. In peer-to-peer, computers can both provide and request services acting as equals. It also describes socket interfaces which allow processes to communicate by abstracting the lower layers and defining socket addresses that combine IP and port numbers.

Uploaded by

ahmedehab1772002
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

Lecture 5 Computer Networks

This document provides an overview of the application layer in computer networks. It discusses two main paradigms at the application layer: client-server and peer-to-peer. In client-server, a client initiates communication by requesting services from a server. In peer-to-peer, computers can both provide and request services acting as equals. It also describes socket interfaces which allow processes to communicate by abstracting the lower layers and defining socket addresses that combine IP and port numbers.

Uploaded by

ahmedehab1772002
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Computer Networks

Ch.2: Application Layer

Prepared By
Dr. Ibrahim Attiya
© 2023 NMU
Ch.2: Outline
❑ Introduction
❑ Application-Layer Paradigms
❑ Client-server Paradigm
❑ Socket Interface
❑ Standard Applications
❑ Peer-to-peer Paradigm
❑ Socket-interface Programming
Introduction
➢ The whole Internet, was designed and
developed to provide services at the application
layer of the TCP/IP protocol suite.
➢ The other four layers are there to make these
services possible.
➢ Communication is provided using a logical
connection, which means that the two
application layers assume that there is an
imaginary direct connection through which they
can send and receive messages.
Introduction

Logical connection at the application layer


Providing Services
➢ Since the application layer is the only layer that
provides services to the Internet user, it allows
new application protocols to be easily added to
the Internet, which has been occurring during
the lifetime of the Internet.
➢ When the Internet was created, only a few
application protocols were available to the
users; today we cannot give a number for these
protocols because new ones are being added
constantly.
Standard and Nonstandard
Protocols
➢ To provide a smooth operation of the Internet,
the protocols used in the first four layers of the
TCP/IP suite need to be standardized and
documented.
➢ They normally become part of the package that
is included in operating systems such as
Windows or UNIX.
➢ To be flexible, however, the application-layer
protocols can be both standard and nonstandard.
Standard Application-Layer
Protocols
➢ There are several application-layer protocols
that have been standardized and documented by
the Internet authority, and we are using them in
our daily interaction with the Internet.
➢ Each standard protocol is a pair of computer
programs that interact with the user and the
transport layer to provide a specific service to
the user.
Nonstandard Application-Layer
Protocols
➢ A programmer can create a nonstandard
application-layer program if he/she can write
two programs that provide service to the user by
interacting with the transport layer.
➢ The creation of a nonstandard protocol that does
not even need the approval of the Internet
authorities if privately used, has made the
Internet so popular in the world.
▪ A private company can create a new customized
application protocol to communicate with all of its
offices around the world.
Application-Layer Paradigms
➢ It should be clear that to use the Internet we
need two application programs to interact with
each other:
▪ One running on a computer somewhere in the
world, the other running on another computer
somewhere else in the world.
➢ The two programs need to send messages to
each other through the Internet infrastructure.
Application-Layer Paradigms
➢ Should both application programs be able to
request services and provide services, or should
the application programs just do one or the
other?
➢ Two paradigms have been developed during the
lifetime of the Internet to answer this question:
the client-server paradigm and the peer-to-peer
paradigm.
Traditional Paradigm: Client-
Server
➢ The traditional paradigm is called the client-
server paradigm.
➢ It was the most popular paradigm until a few
years ago.
➢ In this paradigm, the service provider is an
application program, called the server process;
it runs continuously, waiting for another
application program, called the client process,
to make a connection through the Internet and
ask for service.
Traditional Paradigm: Client-
Server
➢ There are normally some server processes that
can provide a specific type of service, but there
are many clients that request service from any
of these server processes.
➢ The server process must be running all the time;
the client process is started when the client
needs to receive service.
➢ Although the communication in the client-
server paradigm is between two application
programs, the role of each program is totally
different.
Traditional Paradigm: Client-
Server
Traditional Paradigm: Client-
Disadvantages of
Server Client-Server Paradigm
➢ One problem with this paradigm is that the
concentration of the communication load is on
the shoulder of the server, which means the
server should be a powerful computer.
➢ Another problem is that the service must always
return some type of income for the server in
order to encourage such an arrangement.
➢ Several traditional services are still using this
paradigm, including the WWW and its vehicle
HTTP, FTP, SSH, e-mail, and so on.
New Paradigm: Peer-to-Peer
(P2P)
➢ In this paradigm, there is no need for a server
process to be running all the time and waiting
for the client processes to connect. The
responsibility is shared between peers.
➢ A computer connected to the Internet can
provide service at one time and receive service
at another time.
➢ A computer can even provide and receive
services at the same time.
➢ One of the areas that really fits in this paradigm is
the Internet telephony.
New Paradigm: Peer-to-Peer
(P2P)
New Paradigm: Peer-to-Peer
(P2P)
➢ The main challenge has been security; it is more
difficult to create secure communication
between distributed services than between those
controlled by some dedicated servers.
➢ The other challenge is applicability; it appears
that not all applications can use this new
paradigm.
➢ There are some new applications, such as
BitTorrent, Skype, IPTV, and Internet
telephony, that use this paradigm.
Client-server Paradigm
➢ In this paradigm, communication at the
application layer is between two running
application programs called processes: a client
and a server.
➢ A client is a running program that initializes the
communication by sending a request; a server is
another application program that waits for a
request from a client.
➢ The server handles the request received from a
client, prepares a result, and sends the result
back to the client.
Application Programming
Interface
➢ If we need a process to be able to communicate
with another process, we need a new set of
instructions to tell the lowest four layers of the
TCP/IP suite to open the connection, send and
receive data from the other end, and close the
connection.
➢ A set of instructions of this kind is normally
referred to as Application Programming
Interface (API).
➢ An interface in programming is a set of
instructions between two entities.
Application Programming
Interface
➢ In this case, one of the entities is the process at
the application layer and the other is the
operating system that encapsulates the first four
layers of the TCP/IP protocol suite.
➢ In this way, the processes running at the
application layer are able to communicate with
the operating system when sending and
receiving messages through the Internet.
➢ Several APIs have been designed for
communication. Among them is the socket
interface.
Socket Interface
➢ Socket interface started in the early 1980s at
UC Berkeley as part of a UNIX environment.
➢ The socket interface is a set of instructions that
provide communication between the application
layer and the operating system.
➢ It is a set of instructions that can be used by a
process to communicate with another process.
➢ The idea of sockets allows us to use the set of all
instructions already designed in a programming
language for other sources and sinks.
Socket Interface

Position of the socket interface


Socket Interface

A Sockets used like other sources and sinks


Socket Interface
➢ Although a socket is supposed to behave like a
terminal or a file, it is not a physical entity like
them; it is an abstraction. It is a data structure
that is created and used by the application
program.
➢ The client thinks that the socket is the entity
that receives the request and gives the response;
the server thinks that the socket is the one that
has a request and needs the response.
Socket Interface
➢ If we create two sockets, one at each end, and
define the source and destination addresses
correctly, we can use the available instructions
to send and receive data.

Use of sockets in process-to-process communication


Socket Interface
➢ The interaction between a client and a server is
two-way communication.
➢ In a two-way communication, we need a pair of
addresses: local (sender) and remote (receiver).
➢ Since communication in the client-server
paradigm is between two sockets, we need a
pair of socket addresses for communication: a
local socket address and a remote socket
address.
Socket Addresses
➢ A socket address should first define the computer
on which a client or a server is running.
➢ A computer on the Internet is uniquely defined
by its IP address, a 32-bit integer in the current
Internet version.
➢ However, several client or server processes may
be running at the same time on a computer,
which means that we need another identifier to
define the specific client or server involved in
the communication.
Socket Addresses
➢ Hence, an application program can be defined
by a port number, a 16-bit integer.
▪ Ex., port numbers: ─HTTP server: 80 ─ Mail server: 25
➢ This means that a socket address should be a
combination of an IP address and a port
number.
Finding Socket Addresses
➢ The server/client socket address is provided by
the operating system.
▪ The operating system knows the IP address of the
computer on which the server process is running.
▪ The port number of a server process, however, needs
to be assigned. If the server process is a standard one
defined by the Internet authority, a port number is
already assigned to it. Otherwise, the designer of the
server process can choose a port number, in the
range defined by the Internet authority, and assign it
to the process.
Using Services of Transport Layer
➢ A pair of processes provide services to the users
of the Internet, need to use the services
provided by the transport layer for
communication because there is no physical
communication at the application layer.
➢ The three common transport layer protocols in
the TCP/IP suite: UDP, TCP, and SCTP.
➢ Most standard applications have been designed
to use the services of one of these protocols.
➢ When we write a new application, we can
decide which protocol we want to use.
Any Questions?

You might also like