Computer Networks - Principles of Application Layer Protocols

Table of contents

1. Network application architecture

1.1 Client/Server Architecture

1.2 P2P structure 

1.3 Hybrid structure 

2. Process communication

2.1 Identification process communication 

2.2 socket (socket) 

3. Service requirements of web applications

3.1 Reliable data transmission

3.2 Throughput

3.3 Timing

3.4 Security 

3.5 Requirements for common network applications 

4. Transmission services provided by the Internet 

4.1 TCP service

4.2 UDP service 

5. Application layer protocol 


Preface: Network applications are the reason for the existence of computer networks. These applications provide services for users at the application layer, and the network programs that meet our daily needs are all at the application layer  

1. Network application architecture

The architecture of the application layer is different from the architecture of the network discussed before. The architecture of the network is fixed, while the application architecture ( application architecture ) is designed by the application developer. organize the application on

There are currently three mainstream application architectures :

  • Client-server architecture ( client-server, C/S )
  • Point-to-point structure ( Peer-to-peer, P2P )
  • Hybrid structure ( Hybrid )

1.1 Client/Server Architecture

  • Client: A host that requests services from a server
  • Server: an always-on host that serves requests from other hosts called clients 

Well-known applications of the client-server model include Web, FTP, Telnet, and email. A typical example is a Web application, where an always-on Web server serves requests from browsers (running on client hosts)

The server features are:

  • 7*24 hours to provide service
  • Permanent access address/domain name
  • Scalability with a large number of servers

The client features are:

  • Communicate with the server and use the services provided by the server
  • Intermittent access to the network
  • Possibly use a dynamic IP address
  • Does not communicate directly with other clients 

Typically, a single server can become overwhelmed if the server receives too many requests. For this reason, data centers ( data centers ) equipped with a large number of hosts are often used to create powerful virtual servers. For example, Google has 30-50 data centers distributed all over the world, and each data center can have hundreds of thousands of servers

1.2 P2P structure 

In the P2P structure, the dependence on the server is reduced, and instead the application can communicate directly between the hosts, which are called peers.

Many currently popular, traffic-intensive applications are P2P architecture, including file sharing (such as BitTorrent), peer-assisted download accelerators (such as Thunder), Internet telephony and video conferencing (such as Skype) 

The characteristics of P2P are:

  • no always-on servers
  • Direct communication between any end systems/nodes
  • Nodes are intermittently connected to the network
  • Nodes may change IP addresses 

The advantage of the P2P architecture, and one of the most fascinating features, is its self-scalability . In a P2P file sharing application, although each peer generates workload due to requesting files, each peer passes to Other peers distribute files also adding service capabilities to the system

The disadvantage of the P2P architecture is that it is difficult to manage

1.3 Hybrid structure 

Combining the characteristics of C/S structure and P2P structure, a hybrid structure was born on the basis of making full use of their respective advantages and avoiding disadvantages

A typical example is Napster, which is a software that can download MP3 files you want on the Internet. It can also make its own machine a server, providing downloads for other users.

The features of Napster are:

  • File transfer uses P2P structure
  • File search adopts C/S structure——centralized (each node registers its own content with the central server, and each node submits a query request to the central server to find interesting content) 

2. Process communication

2.1 Identification process communication 

In operating system terms, communication between applications is actually communication between processes , which are programs running on the host

Processes running on the same host can communicate with each other through the inter-process communication mechanism and the operating system

Process communication between processes running on different hosts is mainly through message exchange

In a client-server structure

Client process : the process that initiates the communication
Server process : the process that waits for the communication request 

In a P2P file sharing structure

The peer that downloaded the file is identified as a client

The peer that uploaded the file is identified as the server

2.2 socket (socket) 

Most applications consist of pairs of communicating processes, with two processes in each team sending messages to each other. Processes send and receive messages to and from the network through a software interface called a socket

Inter-process communication is realized by using socket to send/receive messages, which is similar to sending a letter

  1. The sender sends the message to the mailbox outside the door (the door here is equivalent to a socket)
  2. The sender relies on (outside the door) transmission infrastructure to deliver the message to the host where the receiver is located, and sends it outside the door of the receiver
  3. The receiver gets the message from outside the door

In order to achieve inter-process communication on different hosts, each process must have an identifier , and each host has a unique IP address, but this is not enough to uniquely identify a process (there can be multiple processes on a host that need to communicate), We assign a port number to each process on the host that needs to communicate , and use IP address + port number to identify a process

IP address : the identification of the host, an IP address can uniquely identify a host 

Port number : the identification of the process on the host, a port number can uniquely identify a process on the host, typical examples are:

HTTP Server:80

Mail Server:25

3. Service requirements of web applications

The computer network is a hierarchical structure, the lower layer provides services for the upper layer, and this service is realized through the interface

In the five-layer reference model we adopt, the lower layer of the application layer is the transport layer, and the socket is the interface between the application program and the transport layer protocol . Therefore, when designing an application program, it is often selected according to the requirements of the application program. transport layer protocol

Classify an application's service requirements in four areas: reliable data transfer , throughput , timing , and security

3.1 Reliable data transmission

As discussed earlier, packets can be lost in computer networks—router buffers overflow, packets get corrupted and dropped. And some applications are intolerable to data loss, such as e-mail, file transfer, remote host access, Web document transfer, and financial applications, etc.

To support these applications, some work must be done to ensure that data sent by one side of the application is delivered correctly and completely to the other side of the application

A protocol is said to provide a reliable transport mechanism if it provides a service to ensure data delivery

When a transport layer protocol provides reliable data transmission, the sending process can fully trust that the data will reach the receiving process without error as long as it passes its data into the socket

Some applications are not sensitive to data loss. Such applications are called loss -tolerant applications . The most common are multimedia applications, such as conversational audio/video, which can tolerate a certain amount of data loss .

3.2 Throughput

Available throughput is the rate at which the sending process can deliver bits to the receiving process

The communication between two processes often depends on a certain network path, and the bandwidth of this path will be shared by other sessions. As the session arrives and leaves, the available throughput will fluctuate.

For some applications, the transport layer protocol must guarantee that it can provide a guaranteed available throughput at a certain rate

For example, if an Internet telephony application encodes speech at 32kbps, it needs to send data to the network at that rate and deliver data at that rate to the receiving application. If the protocol cannot provide this throughput, the application must Encode at a lower rate or give up sending. Such applications with throughput requirements are called bandwidth-sensitive applications ( bandwidth-sensitive applications )

Applications like e-mail, file transfer, and web delivery that utilize more or less of the available throughput according to available bandwidth are called  elastic applications

3.3 Timing

The transport layer protocol can also provide timing guarantees, for example: each bit injected into the socket by the sender reaches the socket of the receiver no later than 100ms

Such a service would be attractive for interactive real-time applications such as Internet telephony, virtual environments, teleconferencing, and multiparty gaming, all of which require data delivery with strict time constraints for effectiveness 

When making calls and multiplayer games, this service can ensure that the delay is within a certain range to meet the real-time nature of calls or games

3.4 Security 

Transport layer protocols can also provide one or more security services to applications. A service that provides confidentiality between the sending and receiving process , preventing the data from being observed in some way between the two processes

For example: in the sending host, the transport layer protocol can encrypt all data transmitted by the sending process, and in the receiving host, the transport layer protocol can decrypt the data before it is delivered to the receiving process

3.5 Requirements for common network applications 

application data lost bandwidth time sensitive
file transfer can not be lost elasticity No
e-mail can not be lost elasticity No
Web documents can not be lost Elasticity (several kbps) No
Internet telephony/video conferencing tolerance loss

Audio (several kbps~1Mbps)

Video (10kbps~5Mbps)

Yes, 100ms
Stream audio/video tolerance loss ditto yes, seconds
interactive game tolerance loss Several kbps~10kbps Yes, 100ms
smartphone message can not be lost elasticity yes and no

4. Transmission services provided by the Internet 

The Internet (more generally, the TCP/IP network) provides two transport layer protocols for applications—TCP and UDP. As a software developer, when creating a new application for the Internet, the first decision to make is to choose UDP or TCP

4.1 TCP service

The TCP service model includes connection-oriented services and reliable data transmission services

connection-oriented

  • Before the application layer data packets start to flow, TCP allows the client and server to exchange transport layer control information with each other, which is called "handshake".
  • After the "handshake", a TCP connection is established between the sockets of the two processes, and this connection is full- duplex
  • The application has finished sending the message and the connection must be removed

reliable data transmission

  • Communication processes can rely on TCP to deliver data sent without error and in proper order
  • TCP data delivery is based on byte stream

In addition, neither TCP nor UDP provides any encryption mechanism. In order to ensure security, the Internet community has developed an enhanced version of TCP— Secure Sockets LayerSecure Sockets Layer, SSL  ), which provides process-to-process security services, including encryption, data integrity, and endpoint authentication

4.2 UDP service

UDP is connectionless , it provides unreliable data transmission services , and is a protocol that does its best to deliver data to the upper layer (the implication is that the accuracy of data delivery cannot be guaranteed)

When a process sends a message into a UDP socket, the UDP protocol does not guarantee that the message will reach the receiving process. Not only that, the packets arriving at the receiving process may also arrive out of order 

We will introduce the relevant knowledge of TCP and UDP in detail at the transport layer

5. Application layer protocol 

Now that we know how the application sends messages into the socket and realizes network process communication, the next problem we face is how to specify the application layer protocol

Network applications need to follow the application layer protocol, which defines how application processes running on different end systems can transmit messages to each other. Some application layer protocols are public, these protocols

  • Defined by RFC ( Request For Comments
  •  allow interoperability
  • HTTP, SMTP, ……

There are some application layer protocols that are proprietary,

  • Most P2P file sharing applications 

The content of the application layer protocol mainly includes

  • Message type (type) - request message, response message
  • The syntax/format of the message - what fields are in the message and how each field is described
  • Semantics of the field - the meaning of the information in the field
  • rules - when a process sends/responses to a message, how a process sends/responses a message
The format of the HTTP request message

Guess you like

Origin blog.csdn.net/weixin_58165485/article/details/128599605