My Github address
Notes on data Structures and Algorithms
Notes for geek Time iOS Developer Class
IOS large factory interview high frequency algorithm summary
Summary of iOS interview materials
Network interconnection model
- In order to better promote the research and development of the Internet, the international organization for Standardization ISO developed the network interconnection model in 1985
- OSI (Open System Interconnect Reference Model), with 7 layers structure
Request process
The network layer
The physical layer
- The physical layer defines interface standards, cable standards, transmission rates, and transmission modes
Digital signal, analog signal
- Analog Signal
- Continuous signal suitable for long distance transmission
- Poor anti-interference ability, waveform distortion is difficult to correct when disturbed
- Digital Signal
- Discrete signals, not suitable for long distance transmission
- Strong anti-interference ability, waveform distortion can be repaired when disturbed
Data communication model
Channel (Channel)
- Channel: The channel through which information is transmitted. There can be more than one channel on a transmission medium (such as a network cable)
- Simplex communication:
- A signal can only be transmitted in one direction, and the direction of transmission cannot be changed at any time
- Such as
Radio broadcast
.Cable television broadcasting
- Half duplex communication:
- Signals can be transmitted in both directions, but they must be transmitted alternately, only in one direction at a time
- Such as
intercom
- Full duplex communication:
- Signals can be transmitted both ways simultaneously
- Such as
Mobile phone
Data link layer
- Link: A physical line (wired or wireless) from one node to an adjacent node, with no other switching nodes in between
- Data link: When data is transmitted over a link, a corresponding communication protocol is required to control data transmission
- Different types of data links may use different communication protocols
- Broadcast channel: CSMA/CD protocol (e.g. network of coaxial cables, hubs, etc.)
- Point-to-point channel: PPP (e.g. channel between 2 routers)
- Different types of data links may use different communication protocols
- There are three basic problems with the data link layer:
- Encapsulated into a frame
- Transparent transmission
- Error inspection
Encapsulated into a frame
- The data part of a Frame
- Is the Packet (IP Packet, Packet) transmitted from the network layer.
- Maximum Transfer Unit (MTU)
- Each data link layer protocol sets an upper limit on the data length of frames that can be transmitted
- The MTU of the Ethernet is 1500 bytes
Transparent transmission
Error inspection
CSMA/CD protocol
- CSMA/CD (Carrier Sense Multiple Access with Collision Detection)
- Carrier sense multiple access/collision detection
- Using the
CSMA/CD
The network of is can be calledEthernet
, which transmits Ethernet frames- Ethernet frames are in the following formats: Ethernet V2 standard, IEEE 802.3 standard
- The most used is: Ethernet V2 standard
- Ethernet frames are at least 64 bytes long in order to be able to detect whether a conflict has occurred with the frame being sent
- The network consisting of switches already supports full-duplex communication and does not need to be used
CSMA/CD
Protocol, but the frames it transmits are still Ethernet frames- So networks that use switch components are still called Ethernet
Ethernet V2 frame format
- First:
Source MAC address + Destination MAC Address + Network type (IPv4 or IPv6)
- Ethernet frames:
Head + data + FCS
- The length of the data is at least:
64 - 6 - 6 - 2 - 4 = 46 bytes
Standard Ethernet V2
- When the length of the data part is less than
46
Byte time- The data link layer adds some byte padding after the data
- The receiver will strip out the added bytes
- Length summary:
- Ethernet frame data length:
46~1500bytes
- Ethernet frame length:
64~1518bytes
(Destination MAC address + Source MAC address + Network type + Data + FCS)
- Ethernet frame data length:
The network card
- When a nic receives a frame, it checks the frame for errors. If the frame passes the check, it receives the frame. Otherwise, it discards the frame
Wireshark
No frames caughtFCS
, because it catches the frame that passed the error checkFCS
Will be removed by hardware)Wireshark
Failed frame for error check could not be caught
The PPP protocol
Address
Fields: The values in the figure are0xFF
Point-to-point channels do not require source MAC addresses or destination MAC addressesControl
Fields: The values in the figure are0x03
What is the current effectProtocol
Field: Protocol type used internally- Frame start, frame end:
0x7E
Byte filling
- will
0x7E
replace0x7D5E
- will
0x7D
replace0x7D5D