当前位置:网站首页>What is the lszrz protocol used at ordinary times? Talk about xmodem/ymodem/zmodem
What is the lszrz protocol used at ordinary times? Talk about xmodem/ymodem/zmodem
2022-06-12 05:43:00 【Amos-Chen】
XMODEM, YMODEM, and ZMODEM
Because of the usual use of rz/sz More ,r/s A good understanding , One send One receive. But the reason is not clear z What does that mean? , Therefore, there is this article. .sx/rx, sb/rb (b=batch) and sz/rz Implemented separately xmodem,ymodem and zmodem File transfer protocol .
Xmodem(1977 Ward Christensen )->Ymodem(1985 Chuck Forsberg )->Zmodem(1986 Chuck Forsberg)
To have a first Xmodem, Later, it gradually evolved into Ymodem, however Ymodem It's not fast enough and has many shortcomings , Then it developed into Zmodem, This is one of the many file transfer protocols we use in our daily work .
Xmodem
One of the widely used file transfer protocols . The original Xmodem Agreement to use 128 Byte packets and simple The checksum Method as error detection . Subsequently improved to Xmodem-CRC, Use a more secure cyclic redundancy check (Cyclic Redundancy Check ) Method as error detection .Xmodem Protocols always try to take precedence CRC, If the sender does not receive the use CRC Mode request message , The receiver will switch to The checksum Mode to continue requesting transmission .
Checksum method
Package structure
| byte1 | byte2 | byte3 | bytes 4~131=128bytes | byte132 |
|---|---|---|---|---|
| SOH(Start of Header) | block no | 255-(block no) | data packet | checksum |
For example , It takes points to send a document 5 block (block), that block no It's from 1 To 5, And suppose this 5 The packets of the block are d1~d5, that checksum=sum(d1+d2+d3+d4+d5)/256 , here / It's a mold .
How does the receiver know whether a block is the last one ?
Take the above example , In the 5 After the block is sent , Then a message will be sent EOT(End of Transmission) Mark characters , This character is sent as a single byte .
Transmission process

CRC The way
Package structure
| byte1 | byte2 | byte3 | bytes 4~131=128bytes | bytes132~133 |
|---|---|---|---|---|
| SOH | block no | 255-(block no) | data packet | CRC-16 |
CRC In the original way checksum On the basis of , Updated from one byte to two bytes CRC, be relative to checksum More secure .CRC Cyclic redundancy check also belongs to a kind of checksum , But in the strict sense, it does not belong to and But to except
Xmodem-1K
Package structure
| byte1 | byte2 | byte3 | bytes 4~1027=1024bytes | bytes1028~1029 |
|---|---|---|---|---|
| STX | block no | 255-(block no) | data packet | CRC-16 |
Xmodem-1K Essentially, Xmodem-CRC, It's just data packet Increase the length to 1024bytes(1K), Then the first 1 Bytes by SOH Updated to STX. In other systems and BBS It is also called Ymodem,XMODEM-1K Initially Chuck Forsberg In its YMODEM In the agreement XMODEM One of the many improvements made . Forsberg Suggest , Various improvements are optional , It is hoped that software authors can achieve as many improvements as possible . contrary , They usually only meet the minimum requirements , This leads to a large number of semi compatible implementations , And finally from the name “ YMODEM” Split into “ XMODEM-1K” And all kinds of YMODEM.
Ymodem
Ymodem yes Chuck Forsberg Yes Xmodem Improvement , but Ymodem Is named by Xmodem The original author of Ward Christensen give .Ymodem Essentially, Xmodem-1K, It allows you to work in the same conversation (session) Multiple files are transferred simultaneously in . On some systems , It's listed as Ymodem Batch.
Package structure
Ymodem stay Xmodem Develop on the basis of , Continue to use TeLink The method of adding short blocks to the protocol , That is to say, increase block 0. The block Identifies the of the file to be sent file name , file size and File creation timestamp , as follows :
| byte1 | byte2 | byte3 | bytes 4~131=128bytes | bytes132~133 |
|---|---|---|---|---|
| SOH | 0x00 | 0xFF | file name file size Time stamp | CRC-16 |
Ymodem Of block n structure ( Not the second 0 block ), data packet It can be either 128 It can also be 1024 position , Can be controlled by command
| byte1 | byte2 | byte3 | bytes 4~131=128bytes | bytes132~133 |
|---|---|---|---|---|
| SOH | block no | 255-(block no) | data packet | CRC-16 |
| byte1 | byte2 | byte3 | bytes 4~1027=1024bytes | bytes1028~1029 |
|---|---|---|---|---|
| STX | block no | 255-(block no) | data packet | CRC-16 |
Transmission process
Ymodem Allow in the same session (session) Simultaneous transfer of multiple files within , The following shows the transfer process by taking multiple files as an example , A single file is similar to .
With 128 Bit transfer

With 1K transmission

Ymodem-g
YMODEM-g yes Ymodem A variation of the , It's a streaming protocol , Send and receive as a continuous stream 1K Data packets , Until it indicates the need to stop . Before sending the next packet , It doesn't have to wait to receive ACK. The agreement ratio YMODEM faster , Because no delay is introduced between packets , But there is no ability to correct mistakes . If any block transfer fails , Cancel the transfer of the entire file .
Zmodem
As the network speeds up , Existing x/ymodem The speed of the agreement has not kept pace with the times .Zmodem emerge as the times require , It uses a window sliding mechanism ,Zmodem There are two most important characteristics : Efficient , Provides crash recovery .
Efficient
As long as the receiver does not find any errors, the sender is allowed to send packets continuously , No need The sender receive The receiving party Of ACK Mark ( Because there may be delays or errors ). The number of packets allowed to be sent continuously is called window , In most Zmodem In the implementation protocol of 2~16 Number of packages .
Crash recovery
If Zmodem The transmission is cancelled or interfered with for some reason , The transmission can be resumed later , And there is no need to resend the previous content .
Reference resources
http://web.cecs.pdx.edu/~rootd/catdoc/guide/TheGuide_226.html#SEC237
https://en.wikipedia.org/wiki/XMODEM
https://en.wikipedia.org/wiki/YMODEM
https://en.wikipedia.org/wiki/ZMODEM
边栏推荐
- [grpc development] go language builds simple server and client
- 公司注册认缴资金多久
- Halcon 3D 深度图转换为3D图像
- 关于架构(排名不分先后)
- Halcon uses points to fit a plane
- [machine learning] first day of introduction
- Reason: Canonical names should be kebab-case (‘-‘ separated), lowercase alpha-numeric characters and
- 第五讲:数据仓库搭建(三)
- SIM卡信号的驱动电流是多少mA,是否是可调节的?
- beginning一款非常优秀的emlog主题v3.1,支持Emlog Pro
猜你喜欢

Word frequency statistics using Jieba database

Performance test - GTI application service performance monitoring platform

Project requirements specification

yolov5

Stack and queue classic interview questions

What is the project advance payment

Heap classical problem

Filter的注解配置

yolov5

Role and understanding of proc/cmdline
随机推荐
基于tensorflow的校园绿植识别
分公司负责人需要承担的法律责任
Vivado HLS introductory notes
[untitled]
Lldp protocol
Codis 3. X expansion and contraction
GRE protocol details
关于架构(排名不分先后)
29. print matrix clockwise
Webrtc AEC process analysis
FPGA语法的细节
第五讲:数据仓库搭建(三)
Towards End-to-End Lane Detection: an Instance SegmentationApproach
Test work summary - performance test related issues
March 23, 2021
How long is the company's registered capital subscribed
Halcon 用点来拟合平面
Flex/fixed upper, middle and lower (mobile end)
Redis cluster cluster capacity expansion and data migration
Date ()