C8 Application Layer 2025
C8 Application Layer 2025
University of Science
Faculty of Electronics & Telecommunications
Dang Le Khoa
Email: [email protected]
Outline
⚫ Introduction
⚫ Client-Server Programming
⚫ Standard Applications
– World Wide Web and HTTP
– File Transfer Protocol (FTP)
– Electronic Mail
– Domain Name System (DNS)
– TErminaL NETwork (TENET)
– SSH
⚫ Peer-to-Peer Paradigm
10
Mixed Paradigm
11
12
CLIENT-SERVER PROGRAMMING
13
Application Programming Interface
14
Figure 4 Position of the socket interface
15
Figure 5 A sockets used like other sources and sinks
16
Sockets
17
Socket Addresses
⚫ 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).
⚫ The local address in one direction is the remote address in the
other direction and vice versa. 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.
⚫ However, we need to define a socket address in terms of
identifiers used in the TCP/IP protocol suite.
18
3. STANDARD APPLICATIONS
19
World Wide Web and HTTP
20
HyperText Transfer Protocol (HTTP)
21
Example 1
⚫ An example of a nonpersistent
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 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 are needed to
terminate the connection.
22
Example 2
⚫ Figure shows
persistent connection.
Only one connection
establishment and
connection termination
is used, but the request
for the image is sent
separately.
23
Example 3
24
Figure 7 Example of a proxy server
25
HTTP Security
26
27
File Transfer Protocol (FTP)
30
Data Connection
31
Security for FTP
⚫ The FTP protocol was designed when security was not a big
issue. Although FTP requires a password, the password is sent in
plaintext (unencrypted), which means it can be intercepted and
used by an attacker.
⚫ The data transfer connection also transfers data in plaintext,
which is insecure. To be secure, one can add a Secure Socket
Layer between the FTP application layer and the TCP layer. In
this case FTP is called SSL-FTP. We also explore some secure
file transfer applications when we discuss SSH later in the
chapter.
32
33
Electronic Mail
35
Message Transfer Agent: SMTP
⚫ We can say that the e-mail is one of those applications that needs
three uses of client-server paradigms to accomplish its task.
⚫ It is important that we distinguish these three when we are
dealing with e-mail. Figure 10 shows these three client-server
applications. We refer to the first and the second as Message
Transfer Agents (MTAs), the third as Message Access Agent
(MAA).
37
POP
POP is used by an application to retrieve mail from a mail server.
When mail is downloaded from the server to the client using POP
the messages are then deleted on the server.
• The server starts the POP service by
passively listening on TCP port 110 for
client connection requests.
• When a client wants to make use of the
service, it sends a request to establish a TCP
connection with the server.
• When the connection is established, the POP
server sends a greeting.
• The client and POP server then exchange
commands and responses until the
connection is closed or aborted. Note: Since POP does not store messages, it is not recommended fo
small businesses that need a centralized backup solution.
IMAP
IMAP is another protocol that describes a method to retrieve email
messages.
42
Figure 12 Domain name space
43
Figure 13 Hierarchy of name servers
44
Figure 14 Zone
45
Resolution
46
Figure 15 Recursive resolution
47
Figure 16 Iterative resolution
48
Resource Records
49
Example 4
⚫ $nslookup www.fetel.hcmus.edu.vn
⚫ Name: fetel.hcmus.edu.vn
⚫ Address: 112.78.2.108
51
Encapsulation
⚫ DNS can use either UDP or TCP. In both cases the well-
known port used by the server is port 53.
⚫ UDP is used when the size of the response message is less than
512 bytes because most UDP packages have a 512-byte packet
size limit.
⚫ If the size of the response message is more than 512 bytes, a
TCP connection is used. In that case, one of two scenarios can
occur.
52
Registrars
53
Security of DNS
54
55
TELNET
56
Local versus Remote Logging
57
Network Virtual Terminal (NVT)
59
User Interface
60
61
Secure Shell (SSH)
62
Components
64
Port Forwarding
65
Figure 20 Port forwarding
66
Format of the SSH Packets
67
68
PEER-TO-PERR PARADIGM
69
P2P Networks
70
Centralized Networks
71
Figure 22 Centralized network
72
Decentralized Network
73