Java basics: Network + socket, container ocket

Source: Internet
Author: User

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




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.