Network programming, osi seven agreements

network programming

Software development framework

. 1 C / S architecture

c client

s server

2 B / S architecture

b browser

s server

c / s architecture like on our software on the phone now, most of c / s architecture

There are also some already b / s architecture, such as micro-letters, in small programs, third-party payment of treasure features.

What is the server, and the client

The server is available 24 hours uninterrupted service

The client is, any time you can go to find the server, for service

History of network programming

Technological developments are often a source of military

Network communication conditions have

A physical transmission medium (telephone lines, cable, network card)

2 a common set of protocols (OSI protocol, for example, two different classes of people, you want to exchange, you must learn the same language, so will define a set of protocols)

OSI protocol (The seven formulas; correspondence table will pass network number thereof)

The OSI 7 layers protocol

Application layer

Presentation layer

Session Layer

Transport Layer

Network layer

data link layer

Physical connection layer

We feel developer layer 5 is enough, and then divided into five layers on the right

Application layer

Transport Layer

Network layer

data link layer

Physical connection layer

What is the physical connection layer

Based on the electric signal, connect two 229

What is the data link layer (Ethernet protocol)

A grouping predetermined electrical signal, the binary grouping

2 provides, each computer connected to the Internet connection have to have a compulsory card

Each piece of card engraved with the world's unique hexadecimal number of a 12

The top six vendors are numbered

After six is ​​the number of water

This is our computer's mac address

A flowchart of the switch

 

 

Switches, Ethernet-based communications

Note that the switch is not across the LAN communication, if there are many computers have access to a computer, there will be a broadcast storm

Broadcast; switch, to each of the requesting computers

Unicast, requesting the computer to the switch

If we want to we need to communicate across the LAN router

Routers work flow chart

 

A LAN, LAN server in order to access another,

You must use a router

互联网是由多个局域网连接而成的

什么是网络层

IP协议

规定一台接入互联网的计算机,必须有一个ip地址

ip地址的特点,点分十进制

ip最小地址 0.0.0.0

ip最大地址 255.255.255.255

ip地址现在有两个版本 ipv4 ipv6

ip地址是动态分配的

什么是传输层

TCP/UDP都是基于端口的工作协议

计算机与计算机之间实际上是通过计算机上的应用软程序来通信的

端口用来标识计算机上的应用程序

端口号的范围0-65535

注意0-1024是操作系统默认使用的端口号

我们应该使用8000之后的端口号

常用软件的端口号

mysql 3306

redis 6379

django 8000

flask 5000

什么是应用层

http协议

ftp协议

TCP协议

流式协议,可靠协议

基于tcp通信,必须建立双向通道

tcp的三次握手,四次挥手

tcp协议的稳定性在于,传输数据时候,是有反馈的

如果服务器给客户端传输数据,客户端没有给服务器返回反馈

服务端就会隔一段时间,再给客户端发数据

如果,客户端一直没有反馈数据

服务端就会关闭通道

图解;

三次握手

 

四次挥手

 

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/cherish937426/p/11311881.html