C / S and B / S structure
c: client s: server client, the server, such as the computer to upload qq, micro-channel
b: browser s: server-side browser services, such as Jingdong, Lynx
bs is the essence of architecture cs
Learning network programming in order to write a software architecture cs
s side:
1, a fixed ip
2, has been stable in operation, and supports concurrent
Network: Network connection medium + network protocol (OSI seven)
Five protocols: the application layer, presentation layer, session layer, transport layer, network layer, data link layer, physical layer
Physical layer:
010101 electrical signal
data link layer:
The electrical physical layer packets, each set of data called a message / data frames, each data frame is divided into: a header and a data head data of two parts
--- each data packet, a header and a data portion by
--- Head: fixed 18 bytes, 6: sender address / 6: the recipient address / 6: Data Type
--- mac address: the sender, the recipient, the recipient address is mac address
- Each card has a unique mac address: 12 hexadecimal number (the first six digits are the manufacturer ID, the last six pipelined number)
- within the same local area network communications, will be broadcast storm
Network layer:
--- ip: ipv4: 32-bit binary represented: dotted decimal notation from 0.0.0.0 to 255.255.255.255, the range is limited, not shown all the network devices, so there ipv6
- Subnet Mask: subnet mask and ip is determined by two ip is in the same network segment, do a bitwise ip address and subnet mask by
------- ip with mac has a conversion relationship
ip address of the host access another ip address
Send --- ARP broadcast packet mode protocol to obtain target main clause mac address
--- mac address learning: mac address and ip address mapping table
The first one will be added to the received data ip / mac mapping table { '1ip Address': Data}
Any kind of protocol has headers and content
Transport Layer:
tcp protocol:
Three-way handshake, the fourth wave, how to establish a connection, how to send data to ensure reliable, disconnect how to disconnect, there is a state in the process of establishing a connection
Services will see a large number of state syn_rcvd
---- dos and ddos attacks: denial of service attacks, distributed denial of service attack
---- Port number: port range 0-65535,0-1023 port is occupied by the system
udp protocol:
--- transmission, no response is required, the data is not reliable
port
--- ip + subnet mask uniquely determined by a device
--- uniquely determined by a software ip + subnet mask + port number
Application layer:
Online process analysis:
--- www.baidu.com input in the browser
--- will take dns server through the domain name resolved to ip address
--- sends a request to this address ip + port number, the server will have access to Baidu
socket: In an abstraction layer between the application layer and transport layer, it is the TCP / IP that the TCP / IP layer complex operations abstract interface to supply a few simple calling process has been implemented with a communication network layer
In python socket by writing a software architecture cs
Four waving