Protocol, is the abbreviation of network protocol, network protocol is a set of conventions that must be followed by both sides of communication computer. Such as how to establish a connection, how to identify each other. Only by following this convention can computers communicate with each other. Its three elements are: grammar, semantics and timing. (1) Grammar: the structure or format of data and control information; (2) Semantic: that is, what control information needs to be sent, what action needs to be completed and what response needs to be made; (3) Time sequence: that is, the detailed description of the sequence of event realization.

TCP/IP

TCP/IP is the protocol used in the Internet today. It not only contains TCP, IP two parts, but by FTP, SMTP, TCP, UDP, IP and other protocols constitute a protocol cluster. The fourth layer of the TCP/IP protocol, the network layer, is responsible for creating the network connection between hosts and accomplishing IP-based addressing and forwarding functions.

DNS

DNS (Domain Name System) is a Domain Name resolution service. It resolves domain names into IP addresses so that people can access the Internet using easy-to-remember English letters. The following example completes a resolution by ping the domain name so that we can get its IP address.

MacBook :~ Aaron $ping baidu.com Ping baidu.com (39.156.69.79): 56 Data bytes 64 bytes from 39.156.69.79: ICMP_seq =0 TTL =49 time= 33.98ms 64 bytes from 39.156.69.79: ICMP_seq =1 TTL =49 time= 34.098ms 64 bytes from 39.156.69.79: Icmp_seq =2 TTL =49 time= 34.129ms -- baidu.com ping statistics -- 3 packets, 3 packets received, 0.0% packet loss round - trip min/avg/Max/stddev 34.129/0.063 = 33.982/34.070 / ms

Local domain name resolution

In addition to DNS, when accessing an internal server via a domain name, you can use the local HOSTS file for domain name resolution, noting that this process takes precedence over DNS. For Windows, the file is C:\ Windows \system32\drivers\etc\hosts. For Linux, it is in /etc/hosts. Here is an example.

Macbook :~ Aaron $more /etc/hosts # built-in loop back address 127.0.0.1 localhost # local test server 127.0.0.1 zentaopms.tester.im # domestic GitHub speed up address 140.82.113.4 github.com

DHCP

DHCP (Dynamic Host Configuration Protocol) is used to dynamically assign available IP addresses to hosts in a LAN. Under Windows, use the ipconfig command, you can view the assigned IP address of the machine, under Linux, please use ifconfig instead.

macbook:~ aaron$ ifconfig lo0: Flags = 8049 < UP, LOOPBACK, RUNNING, MULTICAST > mtu 16384 options = 1203 < RXCSUM TXCSUM, TXSTATUS, SW_TIMESTAMP > inet 127.0.0.1 netmask 0xff000000 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 nd6 options=201<PERFORMNUD,DAD> en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500 options=400<CHANNEL_IO> ether a4:83:e7:8c:45:a1 inet6 Fe80: : 1867:7 b0e: 305 b: 87 f2% en0 prefixlen 64 secured scopeid 0 by 8 inet 192.168.0.100 netmask 0 xffffff00 broadcast 192.168.0.255 ND6 options=201< performNude,DAD> media: autoselect status: active

Two IP addresses are shown here:

LO0 127.0.0.1 is the loopback address used for internal communication on the machine. It is a virtual machine local IP address that is the same for every machine and is always valid; EN0 192.168.0.100 is the dynamic IP address assigned by the DHCP server for the first Ethernet card. After the machine is shut down, DHCP will reserve this address for the machine (network card) for a period of time.

NAT

NAT (Network Address Translation) maps the private IP addresses of the internal Network to different ports of a single IP Address of the public Network to provide external access to the internal Network, thus saving the resource cost of the public IP. For example, the telecom broadband in our home is tied to a single static IP address 58.208.178.58. To access multiple computers in our home from an external office, we can configure NAT on our home router. The results support the use of 58.208.178.58:50001 and 58.208.178.58:50002 forms to connect to the remote desktop of different Windows computers.

VPN

VPN (Virtual Private Network) can establish a Private connection between two locations through a public Network (such as the Internet), and encrypt communication. VPN can be realized by hardware, software and other ways. When employees work remotely at home, they can enjoy the same internal network environment as the company.

HTTP/HTTPS

HTTP (Hypertext Transfer Protocol) is the most widely used Protocol on the Internet. This article that you are reading with your browser is delivered using this protocol. HTTPS is on its basis, to achieve encryption. HTTP/HTTPS is a connectionless, stateless application layer protocol. That is, after the browser makes a request to the server for a response, the connection is closed. A mechanism called Session is used between the browser and the server so that when the next request comes through, the server still knows who the visitor is. A server approach to Session identification usually works with a unique identifier (e.g., JSESSIONID, Bearer Token, Cookie) carried in the request URL or Header. We will discuss this further later when we introduce interface testing.

WebSocket

WebSocket establishes a persistent connection between the client and the server, allowing the server to actively push data to the client for real-time two-way data transmission. It solves the problem that when using HTTP protocol in the past, only single data can be pulled, or when using HTTP to simulate a Long connection, Long Polling resource consumption is too large. WebSocket is an application layer protocol, a subset of the TCP/IP protocol, that performs the handshake over the HTTP protocol when connecting.

RPC

Remote Procedure Call Protocol (RPC) is often used in popular microservice architectures to allow one computer to Call a program on another platform directly without the need to understand the underlying network technology/Protocol. RPC can be implemented based on HTTP (application layer) protocol or directly on top of TCP (transport layer) protocol.

Project directory