Socket related brief introduction 1

write picture description here

First of all, it is necessary to introduce what is network communication. Network communication is nothing more than two computers communicating. First, the picture above:

write picture description here

WEB protocol (TCP/IP)

TCP/IP is the most widely used protocol in the world. It is a collection of multiple protocols at different levels based on TCP and IP. It is also called: TCP/IP protocol suite or TCP/IP protocol stack.

TCP: Transmission Control Protocol Tramsmission Control Protocol
IP: Internet Protocol

TCP/IP model

Above:
write picture description here

Layer 5: Http Hypertext Transfer Protocol, FTP File Transfer Protocol, SMTP Mail Transfer Protocol Layer
4 : TCP/IP Protocol
Layer 3:
Layer 2: Data
Stream Layer 1: Network Cable, Network Card, Circuit Board

IP address

In order to realize the communication between different computers, each machine must have a unique identification - IP address,
which means that each computer has an ID, just like each of us has an ID card! ! ! For example, each of us can only have a unique phone number, and we can call each other.

IP address format: digital 192.168.0.2, using the IPV4 version, the length of the IP address is 32-bit binary

port

1. The port number range is 0~65535, of which 0-1023 bits are reserved by the system.
2. A channel entry and exit used to distinguish different applications.
3. The IP address and port number form the so-called Socket. Socket is the end point of the two-way communication link between the programs running on the network and is the basis of TCP/UDP.
4. Common port numbers
http:80
fit:21
telnet:23

Network Support in JAVA

For different levels of network communication, java provides network function APIs in four categories:
1-InetAddress: used to represent hardware resources on the network
2-URL Uniform Resource Locator, through which URL can directly read or write data on the network
3-Socket is actually a network communication-related class based on TCP.
4 – Datagram: Use the UDP protocol to save data in datagrams and communicate over the network.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325566328&siteId=291194637