Network Programming: OSI protocol, three-way handshake fourth wave

network programming:

Software development framework

1, C / S architecture (client / server)

c: Client s: server

2, B / S architecture (browser / server)

b: the browser s: server

ps: b / s architecture essentials is c / s architecture

In recent years, b / s architecture is on the rise, such as: micro-channel applets, small programs Alipay

Because Alipay and micro-channel are doing one thing: a unified interface

So after the phone is not the end of the b / s architecture will certainly fire

Server: have been waiting for this client sends a service request to
the client: When do you need the service, the service sends a request to the server

Learning Network Programming: cs can develop a software architecture of
concurrent database front-end django: can a software architecture for bs

 

 

History of network programming:

Any existing advanced technology first are derived from military

Past Network Development:

 1. early telephone telephone line

2. Big Ass Diannao cable

3. Laptop computer wireless phone card

Conditions achieve remote communication need to have:

1, the physical connection medium

2, a common set of standard protocols

ps: people have to say in order to achieve smooth communication unified language English >>>
between the computer and the computer in order to achieve remote communication in addition to the physical connection media outside also need
a set of common standards / protocols

 

OSI protocol

OSI seven-layer protocol (should table will pass network number object)

The application layer
represents a layer
session layer
transport layer,
network layer,
data link layer,
a physical connection layer


Five-layer OSI protocol


Application layer
transport layer
network layer
a data link layer,
a physical connection layer

1. The physical connection layer

010101001010 binary data based on the electrical signal transmission

2. Data Link Layer

Work:

1. The predetermined electric signal grouping (you may not know the physical layer transmission connection over a few binary data as a set)
2 specifies any one of the computers connected to the Internet must have a network card, a card for each the above is engraved with a unique number in the world

Card number (mac address):

12-digit hexadecimal number
before the number six is the vendor
after six pipelined number
we call this tube mac address number 12

ps: the above two points collectively referred to as "Ethernet protocol"

switch

Based on the shortcomings of Ethernet protocol for communication:
can not communicate across local area network

 

Internet: connected between each other a plurality of local area networks formed

3. Network Layer

IP protocol

IP-based communications between the LAN communication can be realized


As long as the provisions of the computer connected to the Internet must have an IP address
ip address Features: dotted decimal
ip address minimum: 0.0.0.0
ip address maximum: 255.255.255.255
ip address is currently available in two versions: IPV4 IPV6 (IPV4 been due not enough that the current existence of the computer so the introduction of the IPV6 version)
IP address is dynamically allocated

4. Transport Layer


TCP \ UDP is a protocol based on the port work
port (Port)
between the computer and the computer communication: the communication between the application and the application on the computer (network-based data transmission, data is sent to the first computer memory , the port found by which specific application)

Port: An identifier for a computer on an application
range of port numbers: 0 to 65535
Note: 0 to 1024. These are the operating system default port number used
Recommendation: Use the port after 8000

Several common port numbers:

MySQL default port: 3306
Redis Default Port: 6379
Django default port: 8000
the Flask default port: 5000

port number is dynamically assigned
Example: for the first time since qq is assigned to is that if 8989
       will shut qq start port number might change again the

5. Summary

ip address: An identifier for a computer to access the Internet
port Port: An identifier for an application on one computer
ip + port: uniquely identifies the Internet access an application on a computer

The application layer

HTTP protocol

FTP protocol

 

TCP protocol:

Streaming protocol, a reliable protocol
based on TCP protocol to establish a bidirectional communication channel Required

The reason why the TCP protocol to transmit data reliably reason is that there is a two-way channel ???

A: it is not reliable because it has a feedback mechanism.

Two-way channel of knowledge:

Four waving three-way handshake:

Data transfer procedure:

The client sends a message to keep a copy of the client, when the server will acknowledge receipt of the message the client's message is empty, or within a certain period of time, from time to time re-sent once.

 Sending a request to: syn = n

Reply request is: ack = n + 1

Three-way handshake build connections

 

 

Four waved off the connection:

Both parties can take the initiative to send a disconnect request

Xinggui
star derailment

Guess you like

Origin www.cnblogs.com/yangjiaoshou/p/11311905.html