FIT3165 / FIT4165 COMPUTER NETWORKS
WEEK 2 – APPLICATION LAYER
Faculty of Information Technology © 2022 Monash University
Copyright By PowCoder代写 加微信 powcoder
Application Layer
2.1 INTRODUCTION
2.2 CLIENT-SERVER PARADIGM 2.3 STANDARDAPPLICATIONS
INTRODUCTION
2.1.1 Application layer
The Application layer will provide:
● A mechanism for accessing information on the network via an application.
● The primary interface between user applications.
● Examples include
○ Telnet for remote logins,
○ File Transfer Protocol (FTP) for file transfers,
○ Simple Mail Transfer Protocol Examples include Telnet for remote logins,
○ Simple Mail Transfer Protocol (SMTP) for email and
○ Hypertext Transfer Protocol (HTTP) for web browsing.
● It is important to distinguish the protocol from the application.
● We might say ‘use telnet to login remotely’ but this really means ‘use an application program which can communicate using telnet protocol to log in remotely’.
Figure 2.1: Logical connection at the application layer
2.1.2 Application-Layer Paradigm
❑ Traditional Paradigm: Client-Server
❑ : Peer-to-Peer
❑ Mixed Paradigm
Figure 2.2: Example of a client-server paradigm
Figure 2.3: Example of a peer-to-peer paradigm
CLIENT-SERVER PARADIGM
A computer language has
• a set of instructions for mathematical operations,
• a set of instructions for string manipulation,
• a set of instructions for input/ output access, and so
2.2.1 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).
2.2.1 Application Programming Interface (continued)
❑ Socket Addresses: IP address and a port number
❑ Finding Socket Addresses
❖ Server Site
❖ Client Site
Figure 2.4: Position of the socket interface
Figure 2.5: A Sockets used like any other sources and sinks
Figure 2.6: Use of sockets in process-to-process communication
Figure 2.7: A socket address
• A socket is one endpoint of a two-way communication link between two programs running on the network
• A socket is bound to a port number so that the TCP layer can identify the application that data is destined to be sent to
• An endpoint = Socket is a combination of an IP address and a port number
Example 2.1 Analogy – telephone & socket
• We can find a two-level address in telephone communication.
• A telephone number can define an organization, and an extension can define a specific connection in that organization.
• The telephone number in this case is similar to the IP address, which defines the whole organization;
• the extension is similar to the port number, which defines the particular connection.
2.2.2 Using Services of Transport Layer
• A pair of processes provide services to the users of the Internet, human or programs.
• A pair of processes, however, need to use the services provided by the transport layer for communication because there is no physical communication at the application layer.
• There are three common transport layer protocols in the TCP/IP suite: UDP, TCP, and SCTP.
❑ UDP Protocol
❑ TCP Protocol
❑ SCTP Protocol
STANDARD CLIENT-SERVER APPLICATIONS
2.3.1 World Wide Web and HTTP
World Wide Web
❖ Architecture
❖ Uniform Resource Locator (URL)
❖ Web Documents
HyperText Transfer Protocol (HTTP)
❖ Nonpersistent versus Persistent Connections
❖ Message Formats
❖ Conditional Request
Web Caching: Proxy Server
❖ Proxy Server Location
❖ Cache Update
HTTP Security
Example 2.2
Assume we need to retrieve a scientific document that contains one reference to another text file and one reference to a large image. Figure 2.8 shows the situation.
• The main document and the image are stored in two separate files in the same site (file A and file B);
• The referenced text file is stored in another site (file C).
• So we are dealing with three different files, we need three
transactions if we want to see/get the whole document.
Figure 2.8: HTTP Example 2.2 (Retrieving two files and one image)
Figure 2.9: Browser
Example 2.3
The URL http://www.mhhe.com/engcs/compsci/forouzan/ defines the web page related to one of the computer in the McGraw-Hill company (the three letters www are part of the host name and are added to the commercial host).
The path is compsci/forouzan/, which defines Forouzan’s web page under the directory compsci (computer science).
Example 2.4
Figure 2.10 shows an example of a non-persistent connection
• The client needs to access a file that contains one link to an image. The text file and image are located on the same server.
• Here we need two connections.
• For each connection, TCP requires at least three
handshake messages( SYN, SYN-ACK, ACK) to establish the connection, but the request can be sent with the third one. After the connection is established, the object can be transferred.
• After receiving an object, another three handshake messages (FIN, FIN-ACK, ACK) are needed to terminate the connection.
Figure 2.10:
HTTP non-persistent connection
Example 2.5
Figure 2.11 shows the same scenario as in Example 2.4, but using a persistent connection.
• Only one connection establishment and connection termination is used, but the request for the image is sent separately.
Figure 2.11: HTTP persistent connection
Figure 2.12: Formats of the request and response messages
Table 2.1: Methods
Table 2.2: Request Header Names Table 2.3: Response Header Names
Example 2.6
This example retrieves a document
• We use the GET method to retrieve an image with
the path /usr/bin/image1.
• The request line shows the method (GET), the URL,
and the HTTP version (1.1).
• The header has two lines that show that the client
can accept images in the GIF or JPEG format.
• The request does not have a body.
• The response message contains the status line and
four lines of header.
• The header lines define the date, server, content
encoding (MIME version, which will be described in electronic mail), and length of the document. The body of the document follows the header..
Figure 2.13: Example 2.6
Example 2.7
In this example, the client wants to send a web page to be posted on the server.
• We use the PUT method.
• The request line shows the method (PUT),
URL, and HTTP version (1.1).
• There are four lines of headers.
• The request body contains the web page to be
• The response message contains the status line
and four lines of headers.
• The created document, which is a CGI
document, is included as the body
Figure 2.14:
Post on the server. We use the PUT method.
Example 2.8
The following shows how a client imposes/forces the modification date and time condition on a request.
The status line in the response shows the file was not modified after the defined point in time. The body of the response message is also empty.
Example 2.9: Cookies
Figure 2.15 shows a scenario in which an electronic
store can benefit from the use of cookies.
• Assume a shopper wants to buy a toy from an electronic
store named BestToys.
• The shopper browser (client) sends a request to the
BestToys server.
• The server creates an empty shopping cart (a list) for the
client and assigns an ID to the cart (for example, 12343).
• The server then sends a response message, which contains the images of all toys available, with a link under each toy
that selects the toy if it is being clicked.
• This response message also includes the Set-Cookie
header line whose value is 12343.
• The client displays the images and stores the cookie value
in a file named BestToys.
Figure 2.15:
Use of Cookies
Example 2.10: Proxy servers
Figure 2.16 shows an example of a use of a proxy server in a local network, such as the
network on a campus or in a company.
• The proxy server is installed in the local network.
• When an HTTP request is created by any of the clients (browsers), the request is first directed to the
proxy server.
• If the proxy server already has the corresponding web page, it sends the response to the client.
• Otherwise, the proxy server acts as a client and sends the request to the web server in the Internet.
• When the response is returned, the proxy server makes a copy and stores it in its cache before sending
it to the requesting client.
Figure 2.16: Example of a proxy server
File Transfer Protocol (FTP) is the standard protocol provided by TCP/IP for copying a file from one host to another. Although transferring files from one system to another seems simple and straightforward, some problems must be dealt with first. For example, two systems may use different file name conventions. Two systems may have different ways to represent data. All of these problems have been solved by FTP in a very simple and elegant approach.
❑ Lifetimes of Two Connections
▪ Control Connection
▪ Data Connection
❖ Communication over Data Connection
❖ File Transfer
Figure 2.17: FTP
2.3.3 TELNET
• A server program can provide a specific service to its corresponding client program. However, it is impossible to have a client/server pair for each type of service we need.
• Another solution is to have a specific client/server program for a set of common scenarios, but to have some generic client/server programs that allow a user on the client site to log into the computer at the server site and use the services available there.
• We refer to these generic client/server pairs as remote logging applications. One of the original remote logging protocols is TELNET.
• However,becauseofserioussecurityconcernswhenusingTelnetoveranopennetwork such as the Internet, its use for this purpose has been waned against & significantly in favour of SSH2.
2.3.4 Secure Shell (SSH)
• Secure Shell (SSH) is a cryptographic network protocol for operating network services securely over an unsecured network.
• SSH provides a secure channel over an unsecured network in a client-server architecture, connecting an SSH client application with an SSH server.
• The most visible application of the protocol is for access to shell accounts on Unix, Linux, windows and other O.S
• SSH was designed as a replacement for TELNET and for unsecured remote shell protocols such as the Berkeley rlogin, rsh, and rexec protocols.
• There are two versions of SSH: SSH-1 and SSH-2, which are totally incompatible. The first version, SSH-1, is now deprecated because of security flaws in it. In this section, we discuss only SSH-2.
2.3.4 (continued)
❑ Components
❖ SSH Transport-Layer Protocol (SSH-TRANS)
❖ SSH Authentication Protocol (SSH-AUTH)
❖ SSH Connection Protocol (SSH-CONN)
❑ Applications
❖ SSH for Remote Logging
❖ SSH for File Transfer
❑ Port Forwarding
❑ Format of the SSH Packets
Figure 2.18: Components of SSH
Figure 2.19: Port Forwarding
Figure 2.20: SSH Packet Format
2.3.5 Domain Name System (DNS)
• To identify an entity, TCP/IP protocols use the IP address, which uniquely identifies the connection of a host to the Internet.
• However, people prefer to use names instead of numeric addresses.
• Therefore, the Internet needs to have a directory system that can map a name to an
• This is analogous to the telephone network.
• A telephone network is designed to use telephone numbers, not names. People can either keep a private file to map a name to the corresponding telephone number or can call the telephone directory to do so.
Domain Name System
❑ Resource Records
❑ DNS Messages
❑ Encapsulation
❑ Registrars
❑ Security of DNS
Name Space
❖ Domain Name Space
❖ Distribution of Name Space
❖ Root Server
DNS in the Internet
❖ Generic Domains
❖ Country Domains
Resolution
Recursive Resolution Iterative Resolution
Figure 2.21: Purpose of DNS Host-name resolution
Figure 2.22: Domain name space
Figure 2.23: Domain names and labels
Figure 2.24: Hierarchy of name servers
Figure 2.25: Zone
Figure 2.26: Generic domains
Table 2.4: Generic domain labels
Figure 2.27: Country domains
Figure 2.28: Recursive Host-name resolution
Figure 2.29: Iterative Host-name resolution
Table 2.5: DNS types
Figure 2.45: DNS message
Note: Both queries and responses have the same general format, containing up to five individual sections carrying information.
The query message:
• contains only the Question section !
While the response messages:
• include the Question, Answer section, Authoritative and Additional sections.
Example 2.11: DNS
In UNIX and Windows, the nslookup utility can be used to retrieve address/name mapping. The following shows how we can retrieve an address when the domain name is given.
● So far we have discussed
○ Introduction to application layer
○ Client – Server Systems
○ Standard applications available in application layer
● Next week
○ TCP/IP Protocol Stack – Transport layer
Reminder : TUTORIALS start this week
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com