Java basics: Network + socket, container ocket
I. Glossary
TCP: Transmission Control Protocol
IP: Internet Protocol
HTTP: Hypertext transfer protocol
FTP: File Transfer Protocol text Transfer Protocol
SMTP: Simple Mail Transfer Protocol
Telnet: Remote LOGON SERVICE
Ii. TCP/IP Model
Iii. Communication Basics
(1) The IP address uniquely identifies a computer.
(2) port number to identify the application on the computer
The port number ranges from 0 to 65535, and 0 to 1024 are reserved by the system. If you want to customize the port number, select 65535.
Common port numbers: HTTP: 80; Ftp: 21; Telnet: 23
(3) IP + port constitute Socket, which is the basis of TCP and UDP.
Iv. Common Socket classes
1: InetAddress
Output result:
2: URL
Uniform Resource Locator: a Uniform Resource Locator is a simple representation of the location and access method of resources that can be obtained from the Internet. It is the address of standard resources on the Internet. Each file on the Internet has a unique URL. It contains information that specifies the location of the file and how the browser should handle it.
The URL consists of two parts: protocol name + Resource Name
Code example: URL Method
Output result:
Example 2: URL reading webpage content