foreword
The basics of computer networks are knowledge that all R&D/operation and maintenance engineers need to master, but they are often ignored.
Today, I will elaborate on the basic learning of computer network, covering TCP/UDP protocol, Http protocol, Socket, etc. I hope you will like it.
1. Computer network architecture
1.1 Introduction
definition
A collection of layers + their protocols for a computer network.
effect
Define the functions that the computer network can accomplish.
1.2 Structure Introduction
There are three types of computer network architecture: OSI architecture, TCP/IP architecture, and five-layer architecture.
OSI architecture: clear concept & complete concept, but complex & impractical;
TCP/IP architecture: Contains a series of network protocols that form the basis of the Internet, is the core protocol of the Internet & is widely used in LANs and WANs;
Five-layer architecture: a fusion of OSI and TCP/IP architecture, the purpose is to learn & explain the principles of computers.
The lower three layers are communication subnets, which are responsible for data transmission;
The upper three layers are resource subnets, which are equivalent to computer systems and complete data processing;
The transport layer connects the preceding and the following.
Detailed introduction to the architecture of TCP/IP
Because the TCP/IP architecture is relatively extensive, it is mainly explained.
OSI architecture in detail
2. TCP protocol _
Transmission Control Protocol, the Transmission Control Protocol
Belongs to the transport layer communication protocol
TCP-based application layer protocols include HTTP, SMTP, FTP, Telnet, and POP3.
3. UDP protocol _
3.1 Definition
User Datagram Protocol, the User Datagram Protocol
Belongs to the transport layer communication protocol
UDP-based application layer protocols include TFTP, SNMP and DNS
3.2 Features
Connectionless, unreliable, message-oriented, no congestion control, the details are as follows:
3.3 Advantages and disadvantages
Advantages: fast
Disadvantage: messages are easily lost (especially when the network is poor)
3.4 Application scenarios (corresponding to application layer protocols)
High communication speed is required
like:
Domain name conversion: DNS protocol
File transfer: FTP protocol
Network management: SNMP protocol
Remote file server: NFS protocol
3.5 Segment format
There are 2 fields in the UDP segment: data field & header field
The following mainly introduces the header (8 bytes, 4 fields)
3.6 Differences between TCP and UDP protocols
4. HTTP protocol _
Introduction
5、Socket
5.1 Introduction
That is, the socket is an intermediate software abstraction layer for communication between the application layer and the TCP/IP protocol family, and it is represented as a programming interface (API) that encapsulates the TCP/IP protocol family
Socket is not a protocol, but a programming call interface (API), which belongs to the transport layer (mainly solves how data is transmitted in the network)
That is: through Socket, we can develop through TCP/IP protocol on the Andorid platform
For users, they only need to call Socket to organize data to conform to the specified protocol, and then they can communicate.
Comes in pairs, a pair of sockets:
Socket ={(IP address 1:PORT port number ) , (IP address 2:PORT port number )}
A Socket instance uniquely represents the communication link of an application on a host
6. Other knowledge
6.1 Enter the url address in the browser ->> the process of displaying the homepage
Open a webpage, which protocols will be used in the whole process
6.2 IP address ( IPv4 address)
definition
A globally unique identifier for each host (or router) connected to the Internet
composition
IP address = 32 bits = network number + host number; that is, IP address::={<network number>, <host number>}
in:
Network number: indicates the network to which the host (or router) is connected. A network number must be unique across the entire Internet.
Host number: mark the host (or router). The network range specified by the network number preceding a host number must be unique.
Different types of IP addresses have different numbers of bytes occupied by the host number & network number; therefore: an IP address is unique within the entire network.
Classification
Traditional IP addresses are classified addresses, which are divided into five categories: A, B, C, D, and E.
The difference is that the number of bytes occupied by the network number & host number is different
Special attention: Among all kinds of IP addresses, some IP addresses are used for special purposes and cannot be used as host IP addresses
6.3 ICMP protocol
definition
Internet Control Message Protocol, the Internet Control Message Protocol
Belongs to the IP layer protocol
Note: The ICMP message is not a high-level protocol, but the data of the IP layer datagram, plus the header of the datagram, to form an IP datagram and send it out
effect
Forward IP packets more efficiently & improve chances of successful delivery
Also allows hosts / routers to report errors & exceptions
Classification
ICMP Error Report Message & ICMP Query Message
main application
PING (packet inter-network detection), Traceroute (track the path of a packet from source to destination, principle = send a series of IP datagrams from source host to destination host)
Below, the process of Ping will be mainly introduced.
6.4 Ping process
definition
Packet InterNet Groper , that is, packet internet detection
It is an important application of ICMP message : using IPCM echo request & echo reply message
It is an example where the application layer directly uses ICMP at the network layer , without TCP and UDP at the transport layer
effect
Test the connectivity of 2 hosts
principle
Send multiple ICMP echo request messages to the destination host
Calculate the round-trip time based on the timestamp in the ICMP echo reply message returned by the destination host
The final displayed results: the IP address sent to the destination host , the number of packets sent & received & lost, the minimum, maximum & average round-trip time
process
Suppose there are two hosts:
(Destination host) PC1 : IP = 192.168.1.1
(source host) PC2 : IP=192.168.1.2
6.5 The difference between a router and a switch
6.6 Cookie and Session
Introduction
Difference & Contrast
6.7 Cookie Giving Token
Introduction
Cookie-based Authentication & Verification Process
Token-based authentication & verification process
---END---