Java socket explain (a): Network Fundamentals

Introduction:

There are two articles in this series, now let's talk about the basics of network communications, second article will specifically Socket principles and code. If you already know the basics of the students can jump directly to the second article:
the Java socket explain (b): TCP achieved by programming the Socket: https://www.jianshu.com/p/400db04b66ca

First, the two hosts how to communicate it across the network?

12474664-d90cc9de5cf811f7.png
Communication between the host

1, ip address: a unique identity mark two hosts.
2, the agreement: the need for a common language to communicate
3, the port number: sign different applications on a single host.

1, IP address

In order to achieve a communication network, between different computers each computer must have a unique identification
ip address format: numeric, such as: 192.168.0.1, currently using more of ip version is IPv4.

2, agreement

TCP / IP protocol
12474664-21964d8ea8a453a7.png
TCP / IP protocol

1, between two hosts communicate, to comply with TCP / IP protocol

TCP / IP five layer model
12474664-d744f31f9bd1e07f.png
image.png

1, the physical layer: the most intuitive access to the user, for example: cable, network cards and the like.
2, Transport Layer: TCP / IP in this layer.
3, Application Layer: HTTP Hypertext Transfer Protocol, FTP file transfer protocol, SMTP Simple Mail Transfer Protocol, and so on.

3, No. port

1, a host of different applications on the sign.
2, the range of port numbers 0-65535, wherein a reservation system used is 0-1023.
3, IP address and port number of the so-called Socket, Socket is the end point of a two-way communication link between programs running on the network, is the basis of TCP and UDP.

Network support Java in four categories

12474664-8599e8951ab537c6.png
image.png

Next article addresses:

Detailed Java socket (B): TCP achieved by programming the Socket: https://www.jianshu.com/p/400db04b66ca

Reproduced in: https: //www.jianshu.com/p/7fc836d86f8c

Guess you like

Origin blog.csdn.net/weixin_34198762/article/details/91162058