WO2011137640A1 - 文件传输方法、文件发送装置和文件接收装置 - Google Patents

文件传输方法、文件发送装置和文件接收装置 Download PDF

Info

Publication number
WO2011137640A1
WO2011137640A1 PCT/CN2010/078835 CN2010078835W WO2011137640A1 WO 2011137640 A1 WO2011137640 A1 WO 2011137640A1 CN 2010078835 W CN2010078835 W CN 2010078835W WO 2011137640 A1 WO2011137640 A1 WO 2011137640A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
data packet
response information
receiving
unit
Prior art date
Application number
PCT/CN2010/078835
Other languages
English (en)
French (fr)
Inventor
方瑜
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2011137640A1 publication Critical patent/WO2011137640A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/12Arrangements for detecting or preventing errors in the information received by using return channel
    • H04L1/16Arrangements for detecting or preventing errors in the information received by using return channel in which the return channel carries supervisory signals, e.g. repetition request signals
    • H04L1/18Automatic repetition systems, e.g. Van Duuren systems

Definitions

  • File transmission method file transmitting device, and file receiving device
  • the present invention relates to a communication system, and more particularly to a file transmission method, a file transmitting apparatus, and a file receiving apparatus in a non-frame structure communication system.
  • the current general download interface and scheme contain the cyclic redundancy check (CRC) mechanism of the program files. Instead of relying solely on the verification of the communication link layer.
  • CRC cyclic redundancy check
  • a non-frame structure which is a register table, such as
  • the basic unit of this type of interface is not a frame structure. It cannot have a CRC check field in each frame. Therefore, the CRC check mechanism for downloading program files is generally based on the entire program file. In the case where the program file is small and the bottleneck of the transfer speed is not very prominent, the verification based on the entire program file is barely feasible. However, as the complexity of the program file increases, the drawbacks of this verification are immediately apparent: You must wait until the entire file transfer is complete before you can verify it. You must wait until the file transfer is complete before you know if the transfer was successful. Retransmission of the entire file, this file download method is relatively inefficient when the file is large.
  • the technical problem to be solved by the present invention is to provide a file transmission method, a file transmitting apparatus, and a file receiving apparatus, which utilize network resources reasonably and improve file downloading efficiency.
  • the present invention provides a file transmission method, including:
  • the file sending device divides the file to be transmitted into several data packets, and adopts a non-frame structure interface. Sending each data packet and its check value to the file receiving device respectively;
  • the file receiving device receives, by the non-frame structure interface, the data packet and the check value thereof, the file receiving device performs verification on the data packet, and if the verification error occurs, returns a response message that fails to be received to the file sending device. ;
  • the file transmitting apparatus retransmits the corresponding data packet and its check value to the file receiving apparatus when receiving the response information of the reception failure.
  • the method further comprises: if the file receiving device correctly verifies the data packet, returning to receive the correct response information to the file sending device.
  • the file sending device respectively sends each data packet and its check value to the file receiving device, and when the file sending device receives the response information that fails to receive, retransmits the corresponding data packet and
  • the step of giving the check value to the file receiving device includes:
  • the file sending device sends a data packet and its check value to the file receiving device, and waits for the response information of the data packet;
  • the step of transmitting, by the file sending device, the data packet further comprises: transmitting identifier information of the data packet; and the step of the file receiving device returning the response information, the response information further carrying the identifier of the data packet Information
  • the method further includes: determining, by the file sending device, the data packet corresponding to the response information according to the identifier information carried in the response message.
  • the step of the file receiving device returning the response information comprises: the file receiving device returns the response information by setting a receiving state of the non-frame structure interface; and the step of the file sending device receiving the response information comprises: The file transmitting apparatus acquires the response information by reading a receiving state of the non-frame structure interface.
  • the present invention further provides a file sending apparatus, the file sending apparatus comprising a sending unit and a status reading unit, wherein: the sending unit is configured to: divide a file to be transmitted into a plurality of data packets, and pass the non-frame
  • the structural interface respectively sends the data packet and the check value thereof to the file receiving device, and receives the response information acquired by the state reading unit, and if the response information is the response information for receiving the failure, Transmitting the data packet and its check value to the file receiving device;
  • the status reading unit is configured to: acquire response information of the data packet from the file receiving device, and send the response information to the transmitting unit.
  • the sending unit is configured to: wait for the response information of the data packet after transmitting the data packet, and send the next data if the correct response information of the data packet is obtained from the state reading unit. And the checksum value is sent to the file receiving device; if the response information of the failure of receiving the data packet is obtained from the state reading unit, the data packet and the check value thereof are retransmitted to the file receiving device , and so on, until all packets have been sent.
  • the sending unit is further configured to: the sent data packet further includes identification information, and the identifier information of the data packet is obtained from the response information, and the response information is determined according to the identifier information. data pack.
  • the status reading unit is configured to: acquire the response information by reading a receiving status of the non-frame structure interface, and send the response information to the sending unit.
  • the present invention also provides a file receiving apparatus, the receiving apparatus comprising a receiving unit, a verification unit and a response unit, wherein:
  • the receiving unit is configured to receive, by using a non-frame structure interface, a plurality of data packets of a file sent by the file sending device and a check value thereof;
  • the check unit is configured to check the received data packet, and send the verification result to the response unit;
  • the response unit is configured to return the response information of the failed reception to the file transmitting device if the verification result is a verification error.
  • the response unit is further configured to return to receive the correct response information to the file sending device if the verification result is correct.
  • the response unit is further configured to acquire the identification information of the data packet from the received data packet, and carry the identification information of the data packet in the response information.
  • the response unit is configured to set a receiving state of the non-frame structure interface
  • the response message is returned to the file transmitting device.
  • the invention introduces the concept of a data packet in the file downloading phase of the non-frame structure communication interface, and advances and divides the verification mechanism of the entire file into each data packet, which is beneficial for the file receiver to perform calibration on each data packet.
  • the test can detect the transmission error of the data packet in time, and request retransmission in time, which greatly improves the success rate of the download.
  • the invention can achieve the purpose of real-time verification and real-time retransmission, and can effectively improve the download success rate in the large file download of the non-frame interface.
  • Figure 1 is a flow chart of a file downloading method for packet verification
  • Figure 2 is a packet processing logic diagram of the file download sender
  • Figure 3 is a packet processing logic diagram of the file download receiving end
  • FIG. 4 is a normal flow chart of the OTU board to the optical module downloading program according to the embodiment of the present invention
  • FIG. 5 is a complete program download processing logic of the optical module.
  • the core idea of the present invention is that the file sending end divides the file to be transmitted into several data packets, each data packet includes several bytes of the file, and sends the data packet and its check value through the non-frame structure interface, and the file is received. Each packet of the file download is verified, and the data packets that do not match are required to be retransmitted.
  • the non-frame structure interface must support the receipt of each packet by the file receiving end to the file sender.
  • the file downloading method for packet verification provided by the present invention includes:
  • Step 101 The file sending end divides the program file into multiple data packets, each data packet includes n bytes, and obtains a check value of each data packet.
  • the check value is a CRC check value.
  • the CRC check value is indicated by A;
  • Step 102 The file sending end sequentially sends n bytes of the data packet to the file receiving end through the non-frame interface, and sends the CRC check value A of the data packet as an additional part of the data packet to the file receiving end;
  • Step 103 The file receiving end receives the n bytes of the data packet and the CRC check value A through the non-frame interface; the file receiving end verifies the received n bytes of the data packet, and obtains the verification result.
  • the method includes: calculating a CRC value according to the received n bytes, and using B; and comparing the locally calculated CRC check value B with the CRC check value A sent by the file sending end:
  • step 104a If B and A are equal, the data packet is received correctly, and step 104a is performed; if B and A are not equal, the data packet is failed to be received, and step 104b is performed;
  • Step 104a The file receiving end sends and receives the correct response message to the file sending end, and requests to continue to deliver the next data packet;
  • Step 104b The file receiving end sends a response message that the receiving failure is sent to the file sending end, and requests to continue to deliver the data packet, that is, retransmit the data packet.
  • One way for the file sender to transmit a data packet is: After the file sender sends each data packet, it needs to wait for the response information of the data packet to determine whether the data packet needs to be retransmitted, and when receiving the data packet, When the correct response message is received, the next data packet and its check value are transmitted to the file receiving end; when receiving the response information of the failed reception, the current data packet and its check value are retransmitted to the file receiving end, and so on, until the sending Finish all the packets.
  • the file sending end sends the identification information of the data packet, and the response information returned by the file receiving end further carries the identification information of the data packet, where the file sending end is according to the The identifier information carried in the response message determines the data packet corresponding to the response information.
  • the file receiving end returns the response information by setting a receiving state of the non-frame structure interface, and the file sending end acquires the response information by reading a receiving state of the non-frame structure interface.
  • the packet processing logic diagram of the file sender is shown in Figure 2, including:
  • Step 201 The file sending end forms a data packet by forming n bytes of the program file, and obtains a CRC check value of the data packet, where the CRC check value is referred to as a first check value;
  • Step 202 The file sending end sequentially sends n bytes to the file receiving end through the non-frame structure interface, and sends the first check value as an additional part of the data packet to the file receiving end;
  • Step 203 the file sending end Reading the receiving status of the file receiving end;
  • Step 204 determining whether the receiving state is "receiving", when the receiving state is receiving, returning to step 203; otherwise, performing step 205;
  • Step 205 determining whether the receiving status is "received receiving correctly", when the receiving status is received correctly, step 206 is performed, otherwise, returning to step 202;
  • Step 206 start sending the next data packet.
  • the packet processing logic diagram of the file receiving end is shown in Figure 3, including:
  • Step 301 the receiving end of the file receiving end is "receiving"
  • Step 302 The file receiving end receives the n bytes and the first check value through the non-frame structure interface, and forms the received n bytes into one data packet.
  • Step 303 The file receiving end calculates the CRC value according to the received n bytes of the data packet, which is called the second check value.
  • Step 304 The file receiving end sends the second check value calculated by the file and the file. The first check value sent by the terminal is compared, if the first check value and the second check value are equal, step 306 is performed; if the first check value and the second check value are not equal, step 305 is performed;
  • Step 305 Set the receiving status to "receive failure", request to retransmit the data packet, and return to the step.
  • Step 306 Set the receiving status to "receive correctly”, apply to transmit the next data packet, and return to step 302 to receive the next data packet.
  • the packet verification and the entire file verification can coexist, that is, the packet verification can be performed during the transmission process, and the entire file is verified after the entire file is transmitted.
  • the packet verification does not have to be stopped on a packet-by-packet basis, and a window mechanism such as multi-package stop can be realized, that is, a response message of the plurality of data packets can be waited after continuously transmitting a plurality of data packets and their check values.
  • a window mechanism such as multi-package stop can be realized, that is, a response message of the plurality of data packets can be waited after continuously transmitting a plurality of data packets and their check values.
  • the response message of the multiple data packets indicates that the file receiving end successfully receives the multiple data packets
  • the subsequent multiple data packets and their check values are transmitted to the file receiving end, and the file receiving end can receive one data packet every time.
  • the data packet is verified, and after receiving multiple data packets continuously, the multiple data packets are separately verified; the file sending end may also transmit all the data packets, and then receive the response information, and the retransmission reception fails. Packets to the receiving end; and so on. Packe
  • the number of bytes included in each packet may be the same or different.
  • the file sender and file receiver can agree on the number of bytes in the packet, or use special characters to identify the start and end of the packet.
  • the number of bytes corresponding to a data packet (that is, the aforementioned n value), that is, the reasonable determination of the packet size needs to balance the transmission speed and the success rate, because the check value of each data packet is generated and compared. It takes a certain amount of time, and the retransmission of a data packet takes more time. The data packet is too small, and the time spent on CRC generation and comparison is relatively large; the data packet is too large, and once it needs to be retransmitted, it takes more time to retransmit.
  • the file downloading method provided by the present invention includes:
  • Step S1 The OTU board starts the download process of the optical module program file.
  • step S3 the OTU board calculates the CRC value Ai of the n bytes of the data packet i to be sent.
  • step S4 the OTU board sends the n bytes in the data packet i through the non-frame interface, and sends the data.
  • Step S5 the optical module receives n bytes in the program file package i through the non-frame interface, and a CRC value Ai;
  • Step S6 the optical module calculates its CRC value Bi for the received n bytes
  • step S7 the optical module compares Ai and Bi. If Ai and Bi are not equal, the optical module returns a response message to the OTU board, and the OTU board is required to send the data packet again, and returns to step S3. If Ai and Bi are equal, step S8 is performed. ;
  • Step S8 the optical module determines whether it is the last data packet, and can determine whether i is equal to m; If it is the last data packet (i is equal to m), after the download is completed, the optical module reports that the OTU board is successfully downloaded. End; if it is not the last data packet (i is less than m), the optical module can continue to respond to the OTU board. Transfer the next data packet, and perform step S9;
  • step S9 the optical module adds 1 to i, and returns to step S3.
  • step S7 when the optical module determines that Ai and Bi are equal, the optical module can directly return the response information that can continue to transmit the next data packet to the OTU board.
  • the OTU board receives the response information, Determine whether it is the last data packet. If not, execute i++ by itself and start the transmission of the next data packet. If yes, inform the optical module that the download is complete.
  • Step 401 The OTU board starts the download process of the optical module program file.
  • Step 402 The optical module enters a state of waiting to receive data.
  • Step 403 The OTU board transmits the first data packet and its CRC value A1 to the optical module.
  • Step 404 The optical module calculates a CRC value B1 of the first data packet.
  • Step 405 The optical module compares B1 and A1, and the two are equal, and the verification succeeds, and the optical module returns a response message that is successfully received to the OTU board.
  • Step 406 The OTU board transmits the next data packet and its CRC value to the optical module, and the optical module performs verification, and returns a successful response message to the OTU board, and repeats the step until the last data is transmitted by the OTU board. Packet and its CRC value to the optical module;
  • Step 407 the optical module calculates a CRC value Bm of the last data packet, and assumes that the data packet is divided into m data packets;
  • Step 408 The optical module compares the Bm and the Am, and the two are equal, and the verification succeeds. The optical module returns the response information of the successful download to the OTU board.
  • Step 501 The optical module receives a program download start command.
  • Step 502 the optical module sets the receiving state to "can start receiving"; Step 503, the optical module detects whether the non-frame interface data downloaded by the program changes; when a change occurs, step 504 is performed;
  • Step 504 the optical module reads n bytes of the program file data packet i and the CRC value Ai of the data packet i, the data packet sequence number i and the total number of data packets m;
  • Step 505 the optical module calculates its CRC value Bi for the received n bytes
  • Step 506 the optical module compares Ai and Bi; if Ai and Bi are not equal, step 507 is performed, if they are equal, step 508 is performed;
  • Step 507 the optical module returns a response message to the OTU board, and requests the OTU board to send the data packet again, and returns to step 503;
  • Step 508 the optical module determines whether it is the last data packet, and can determine whether i is equal to m; if it is not the last data packet (i is less than m), step 509 is performed; if it is the last data packet (i is equal to m) , performing step 510;
  • Step 509 The optical module responds to the OTU board and can continue to transmit the next data packet.
  • Step 510 After the download is complete, the optical module reports that the OTU board is successfully downloaded.
  • the total number of packets can be transmitted by the OTU board when the first packet of the file is sent. During the subsequent transmission, it can no longer be transmitted.
  • the data packet sequence number i may not be transmitted, and the optical module counts the received data packet to determine the number of received data packets;
  • the optical module may not be transmitted to the optical module.
  • the OTU board determines whether all the data packets have been transmitted, or the OTU board carries an end identifier in the last data packet, indicating that the data packet is the last data packet.
  • the method for determining whether or not all the data packets have been transmitted may be variously modified. The present invention does not limit this.
  • the data packet sequence number may also be replaced by the data packet identification information.
  • the data packet is not limited to being verified by using the CRC check, and other verification methods are also applicable.
  • the present invention does not limit this.
  • the interface of the program downloading between the OTU board and the optical module generally has a slow transmission speed, and when the optical module program file is slightly larger (for example, 4M), the entire file transfer time may be required. For dozens of minutes, the entire file uses only one CRC check code. In case there is only one packet wrong, it will take tens of minutes to know the error. I don't know which packet is wrong. I have to retransmit the entire program.
  • the present invention introduces the concept of a data packet in a file downloading phase for a non-frame structure communication interface, and advances and verifies the entire file verification mechanism into each data packet, It is beneficial for the file receiver to check each data packet, and can timely discover the transmission error of the data packet, and request retransmission in time, which greatly improves the success rate of the download.
  • the invention can achieve the purpose of real-time verification and real-time retransmission, and can effectively improve the download success rate in the large file download of the non-frame interface.
  • the file transmission method, the file transmitting apparatus, and the file receiving apparatus of the present invention enter the data packet concept in the file downloading stage of the non-frame structure communication interface, and advance the verification mechanism of the entire file to each subdivision
  • a data packet is beneficial for the file receiver to verify each data packet, and can timely detect the transmission error of the data packet, request retransmission in time, and greatly improve the success rate of the download.
  • the invention can achieve the purpose of real-time verification and real-time retransmission, and can effectively improve the download success rate in the large file download of the non-frame interface.

Abstract

本发明提供了一种非帧结构通讯系统的文件传输方法、文件发送装置和文件接收装置。其中方法包括:文件发送装置将待传输的文件分割成若干个数据包,通过非帧结构接口分别将每个数据包及其校验值发送给文件接收装置;所述文件接收装置通过所述非帧结构接口接收所述数据包及其校验值,对所述数据包进行校验,若校验错误,则返回接收失败的应答信息给所述文件发送装置;所述文件发送装置接收到所述接收失败的应答信息时,重传对应的数据包和其校验值给所述文件接收装置。本发明能达到实时校验,实时要求重传的目的,在非帧接口的大文件下载中,能有效提高下载成功率。

Description

文件传输方法、 文件发送装置和文件接收装置
技术领域
本发明涉及通信系统, 尤其涉及一种在非帧结构通讯系统中的文件传输 方法、 文件发送装置和文件接收装置。
背景技术
目前,微处理器设备需要处理的用户需求日益增加, 处理事务日益复杂, 微处理器程序文件的在线升级日益迫切。 很多以前基本不考虑在线升级的器 件, 如 10G光模块通讯协议 MSA 300Pin, 40G光模块下载协议 CFP, 都纷纷 推出各自的程序文件在线升级接口和方案。
由于微处理器程序文件一般都不小, 从几十 k到几 M不等, 而且由于升 级的严肃性, 目前一般的下载接口和方案中都包含程序文件的循环冗余校验 ( CRC )机制, 而不单单依靠通讯链路层的校验。
目前很多微处理器与上位机的通讯釆用非帧结构, 是釆用寄存器表, 如
DPRAM, MDIO 等。 这类接口基本单元不是帧结构, 无法在每个帧里自带 CRC校验字段, 所以其程序文件下载的 CRC校验机制, 一般都是基于整个 程序文件。 在程序文件较小, 传输速度的瓶颈不是很突出的情况下, 这种基 于整个程序文件的校验还勉强可行。 但随着程序文件的复杂性增加, 这种校 验的弊端立即显现出来: 必须等到整个文件传送结束后才能进行校验, 必须 等到文件传输完毕后才能获知是否传输成功, 在传输不成功时需重传整个文 件, 在文件比较大时, 这种文件下载方法效率比较低。
发明内容
本发明要解决的技术问题是提供一种文件传输方法、 文件发送装置和文 件接收装置, 合理利用网络资源, 提高文件下载效率。
为了解决上述问题, 本发明提供了一种文件传输方法, 包括:
文件发送装置将待传输的文件分割成若干个数据包, 通过非帧结构接口 分别将每个数据包及其校验值发送给文件接收装置;
所述文件接收装置通过所述非帧结构接口接收所述数据包及其校验值, 对所述数据包进行校验, 若校验错误, 则返回接收失败的应答信息给所述文 件发送装置;
所述文件发送装置接收到所述接收失败的应答信息时, 重传对应的数据 包和其校验值给所述文件接收装置。
优选地, 所述方法还包括, 若所述文件接收装置对所述数据包校验正确, 则返回接收正确的应答信息给所述文件发送装置。
优选地, 所述文件发送装置分别将每个数据包及其校验值发送给文件接 收装置, 以及, 所述文件发送装置接收到所述接收失败的应答信息时, 重传 对应的数据包和其校验值给所述文件接收装置的步骤包括:
所述文件发送装置将一个数据包及其校验值发送给文件接收装置 , 等待 所述数据包的应答信息;
若所述应答信息为接收正确, 则发送下一数据包给所述文件接收装置; 若所述应答信息为接收失败, 则重传该数据包和其校验值给所述文件接收装 置; 依次类推, 直到发送完毕所有数据包。
优选地, 所述文件发送装置发送所述数据包的步骤还包括: 发送所述数 据包的标识信息; 所述文件接收装置返回应答信息的步骤中所述应答信息还 携带所述数据包的标识信息;
则, 所述方法还包括: 所述文件发送装置根据所述应答消息中携带的所 述标识信息判断该应答信息对应的数据包。
优选地, 所述文件接收装置返回应答信息的步骤包括: 所述文件接收装 置通过设置所述非帧结构接口的接收状态返回所述应答信息; 所述文件发送 装置接收所述应答信息的步骤包括: 所述文件发送装置通过读取所述非帧结 构接口的接收状态获取所述应答信息。
本发明还提供一种文件发送装置 , 所述文件发送装置包括发送单元和状 态读取单元, 其中: 所述发送单元设置为: 将待传输的文件分割成若干个数据包, 通过非帧 结构接口分别将所述每个数据包及其校验值发送给文件接收装置, 以及, 接 收到所述状态读取单元获取的应答信息, 若所述应答信息为接收失败的应答 信息, 则重传所述数据包及其校验值给所述文件接收装置; 以及
所述状态读取单元设置为:从所述文件接收装置获取数据包的应答信息, 将所述应答信息发送给所述发送单元。
优选地, 所述发送单元是设置为: 发送数据包后, 等待所述数据包的应 答信息, 若从所述状态读取单元获取到该数据包的接收正确的应答信息, 则 发送下一数据包及其校验值给所述文件接收装置; 若从所述状态读取单元获 取到该数据包的接收失败的应答信息, 则重传该数据包及其校验值给所述文 件接收装置, 依次类推, 直到发送完毕所有数据包。
优选地, 所述发送单元还设置为: 发送的所述数据包还包括标识信息, 以及, 从所述应答信息中获取所述数据包的标识信息, 根据所述标识信息判 断该应答信息对应的数据包。
优选地, 所述状态读取单元是设置为: 通过读取所述非帧结构接口的接 收状态获取所述应答信息, 并将所述应答信息发送给所述发送单元。
本发明还提供一种文件接收装置, 所述接收装置包括接收单元、 校验单 元和应答单元, 其中:
所述接收单元设置为通过非帧结构接口接收文件发送装置发送的文件的 若干个数据包及其校验值;
所述校验单元设置为对接收到的所述数据包进行校验, 将校验结果发送 给所述应答单元; 以及
所述应答单元设置为若所述校验结果为校验错误, 则返回接收失败的应 答信息给所述文件发送装置。
优选地, 所述应答单元还设置为若校验结果为校验正确, 则返回接收正 确的应答信息给所述文件发送装置。
优选地, 所述应答单元还设置为从接收到的所述数据包中获取所述数据 包的标识信息, 并在所述应答信息中携带所述数据包的标识信息。
优选地, 所述应答单元是设置为通过设置所述非帧结构接口的接收状态 返回所述应答信息给所述文件发送装置。
本发明对非帧结构通讯接口, 在文件下载阶段引进数据包的概念, 并且 将整个文件的校验机制提前、 细分到每一个数据包, 有利于文件接收者对每 一个数据包就进行校验, 能及时发现数据包的传送错误, 及时要求重传, 极 大提高了下载的成功率。 本发明能达到实时校验, 实时要求重传的目的, 在 非帧接口的大文件下载中, 能有效提高下载成功率。 附图概述
图 1 是分包校验的文件下载方法流程图;
图 2 是文件下载发送端的数据包处理逻辑图;
图 3 是文件下载接收端的数据包处理逻辑图;
图 4 是本发明实施例 OTU单板给光模块下载程序正常流程图; 图 5 是光模块完整的程序下载处理逻辑。 本发明的较佳实施方式
本发明的核心思想是:文件发送端将待传输的文件分割成若干个数据包, 每个数据包包括该文件的若干字节, 通过非帧结构接口发送数据包及其校验 值, 文件接收端对文件下载的每一个数据包都进行校验, 校验不符的数据包 都要求重传。 非帧结构接口必须支持将文件接收端对每一个数据包的接收状 态传递给文件发送端。
如图 1所示, 本发明提供的分包校验的文件下载方法包括:
步骤 101 : 文件发送端将程序文件分割为多个数据包, 每个数据包包括 n 个字节, 获取每一个数据包的校验值, 本实施例中该校验值为 CRC校验值, 该 CRC校验值用 A表示;
步骤 102: 文件发送端通过非帧接口将数据包的 n个字节依次发送给文 件接收端,并且将该数据包的 CRC校验值 A作为该数据包的附加部分一起发 送给文件接收端; 步骤 103: 文件接收端通过非帧接口接收数据包的 n个字节和其 CRC校 验值 A; 文件接收端对接收到的该数据包的 n个字节进行校验, 得到校验结 果, 具体包括: 根据接收到的 n个字节计算其 CRC值, 用 B表示; 将本地计 算出的 CRC校验值 B与文件发送端下发的 CRC校验值 A进行比较:
如果 B和 A相等则该数据包接收正确, 执行步骤 104a; 如果 B和 A不 相等则说明该数据包接收失败, 执行步骤 104b;
步骤 104a: 文件接收端发送接收正确的应答信息给文件发送端, 要求继 续下发下一个数据包;
步骤 104b: 文件接收端发送接收失败的应答信息给文件发送端, 要求继 续下发本数据包, 即重传本数据包。
其中, 文件发送端传输数据包的一种方式是: 文件发送端发送完每一个 数据包, 都需要等待该数据包的应答信息, 以便确定是否需要对该数据包进 行重传, 当接收到接收正确的应答信息时, 传送下一数据包及其校验值至文 件接收端; 接收到接收失败的应答信息时, 重传当前数据包及其校验值至文 件接收端, 依次类推, 直到发送完毕所有数据包。
其中, 文件发送端发送所述数据包时, 还发送所述数据包的标识信息, 所述文件接收端返回的应答信息中还携带所述数据包的标识信息, 所述文件 发送端根据所述应答消息中携带的标识信息判断该应答信息对应的数据包。
其中, 所述文件接收端通过设置所述非帧结构接口的接收状态返回所述 应答信息, 所述文件发送端通过读取所述非帧结构接口的接收状态获取所述 应答信息。
文件发送端的数据包处理逻辑图见图 2, 包括:
步骤 201 , 文件发送端将程序文件的 n个字节组成一个数据包, 获取该 数据包的 CRC校验值, 该 CRC校验值称为第一校验值;
步骤 202, 文件发送端通过非帧结构接口将 n个字节依次发送给文件接 收端, 并且将第一校验值作为该数据包的附加部分一起发送给文件接收端; 步骤 203 , 文件发送端读取文件接收端的接收状态; 步骤 204 , 判断接收状态是否为 "接收中" , 当接收状态为接收中时, 返回步骤 203; 否则, 执行步骤 205;
步骤 205 , 判断接收状态是否为 "接收接收正确" , 当接收状态为接收 正确时, 执行步骤 206, 否则, 返回步骤 202;
步骤 206, 开始下一数据包的发送。
文件接收端的数据包处理逻辑图见图 3 , 包括:
步骤 301 , 文件接收端置接收状态为 "接收中" ;
步骤 302, 文件接收端通过非帧结构接口接收 n个字节和第一校验值, 并将接收到的 n个字节组成一个数据包;
步骤 303:文件接收端根据接收到的数据包的 n个字节计算出其 CRC值, 称为第二校验值; 步骤 304: 文件接收端将自己计算出的第二校验值与文件发送端下发的 第一校验值进行比较, 如果第一校验值和第二校验值相等, 执行步骤 306; 如果第一校验值和第二校验值不相等, 执行步骤 305;
步骤 305 , 置接收状态为 "接收失败" , 申请重传本数据包, 返回步骤
302;
步骤 306 , 置接收状态为 "接收正确" , 申请传送下一数据包, 返回步 骤 302, 进行下一数据包的接收;
其中, 分包校验与整个文件校验可以并存, 即可以在传输过程中进行分 包校验, 在整个文件传输完毕后, 再对整个文件进行校验。
其中, 分包校验并非一定要逐包停等, 也可以实现多包停等的窗口机制, 即:可以在连续发送多个数据包及其校验值后等待该多个数据包的应答消息, 待该多个数据包的应答消息指示文件接收端成功接收该多个数据包时, 传送 后续多个数据包及其校验值至文件接收端, 文件接收端可以每接收到一个数 据包就对该数据包进行校验, 也可以连续接收多个数据包后, 再对该多个数 据包分别进行校验; 文件发送端也可以传送全部数据包后, 再接收应答信息, 重传接收失败的数据包至接收端; 等等。 文件发送端和文件接收端的数据包 传送机制可以进行多种变形, 本发明对此不作限定。
其中, 每个数据包包含的字节数也可以相同, 也可以不同。 文件发送端 和文件接收端可以约定数据包中的字节数, 或者, 使用特殊字符标识数据包 的起始和结束。
其中, 一个数据包对应的字节数(即前面提到的 n值) , 即数据包大小 的合理确定需要在传送速度和成功率方面取得平衡, 因为每一个数据包的校 验值生成和比较要耗费一定的时间, 而一个数据包的重传也要耗费比较多的 时间。数据包太小,耗费在 CRC生成和比较上的时间就比较多;数据包太大, 一旦需要重传, 耗费在重传上的时间比较多。
为进一步说明本发明的技术方案, 下面以光传送单元(OTU ) 的子组件 40G光模块程序文件下载为例, 结合附图描述本发明的具体处理原则。
本发明提供的文件下载方法包括:
步骤 S 1 , OTU单板启动光模块程序文件的下载流程;
步骤 S2, 光模块回应可以接收数据后, OTU单板将光模块程序文件分成 m个数据包, 每个数据包包括 n个字节 (最后一个数据包, 可能有效字节小 于 n, 可补零使其为 n个字节) ; 程序文件数据包序号为 i, 初始时 i=l ;
步骤 S3 , OTU单板计算出要发送的数据包 i中 n个字节的 CRC值 Ai; 步骤 S4, OTU单板通过非帧接口下发数据包 i中的 n字节, 并下发该数 据包的 CRC值 Ai;
步骤 S5, 光模块通过非帧接口接收程序文件包 i 中 n个字节, 以及 CRC 值 Ai;
步骤 S6, 光模块对所接收的 n个字节计算出其 CRC值 Bi;
步骤 S7, 光模块比较 Ai和 Bi; 如果 Ai和 Bi不相等, 光模块返回应答 消息给 OTU单板, 要求 OTU单板再次发送本数据包, 返回步骤 S3; 如果 Ai和 Bi相等, 执行步骤 S8;
步骤 S8, 光模块判断是否为最后一个数据包, 可以通过判断 i是否等于 m; 如果是最后一个数据包 (i等于 m时), 下载完毕, 光模块上报 OTU单板下 载成功; 结束; 如果不是最后一个数据包 (i小于 m时), 光模块回应 OTU单 板可以继续传送下一个数据包, 执行步骤 S9;
步骤 S9, 光模块将 i加 1 , 返回步骤 S3。
在本发明另一实施例中, 步骤 S7中, 光模块判断 Ai和 Bi相等时, 可以 直接返回可以继续传送下一个数据包的应答信息给 OTU单板, OTU单板收 到该应答信息时, 判断是否为最后一个数据包, 如果不是, 自行执行 i++, 开 始下一数据包的传送; 如果是, 则告知光模块下载完毕。
所有数据包均一次传送成功的流程图见附图 4, 包括:
步骤 401 , OTU单板启动光模块程序文件的下载流程;
步骤 402, 光模块进入等待接收数据状态;
步骤 403 , OTU单板传输第一个数据包及其 CRC值 A1至光模块; 步骤 404, 光模块计算第一个数据包的 CRC值 B1 ;
步骤 405, 光模块将 B1和 A1进行比较, 二者相等, 校验成功, 光模块 返回接收成功的应答信息给 OTU单板;
步骤 406, OTU单板传输下一个数据包及其 CRC值至光模块, 光模块进 行校验, 并返回接收成功的应答消息至 OTU单板, 重复执行该步骤, 直到 OTU单板传输最后一个数据包及其 CRC值至光模块;
步骤 407, 光模块计算最后一个数据包的 CRC值 Bm, 假设共分成 m个 数据包;
步骤 408, 光模块将 Bm和 Am进行比较, 二者相等, 校验成功, 光模块 返回下载成功的应答信息给 OTU单板。
光模块完整的程序下载处理逻辑见附图 5, 包括:
步骤 501 , 光模块接收到程序下载开始命令;
步骤 502, 光模块置接收状态为 "可以开始接收" ; 步骤 503 , 光模块检测程序下载的非帧接口数据是否发生变化; 当发生 变化时, 执行步骤 504;
步骤 504, 光模块读取程序文件数据包 i的 n个字节和数据包 i的 CRC 值 Ai, 数据包序号 i和数据包总数 m;
步骤 505, 光模块对所接收的 n个字节计算出其 CRC值 Bi;
步骤 506, 光模块比较 Ai和 Bi; 如果 Ai和 Bi不相等, 执行步骤 507, 如果相等, 执行步骤 508;
步骤 507, 光模块返回应答消息给 OTU单板, 要求 OTU单板再次发送 本数据包, 返回步骤 503;
步骤 508, 光模块判断是否为最后一个数据包, 可以通过判断 i是否等于 m; 如果不是最后一个数据包 (i小于 m时), 执行步骤 509; 如果是最后一个 数据包 (i等于 m时), 执行步骤 510;
步骤 509, 光模块回应 OTU单板可以继续传送下一个数据包, 执行步骤
503;
步骤 510, 下载完毕, 光模块上报 OTU单板下载成功; 结束。
上述实施例可作各种变形, 例如:
数据包总数 m可以由 OTU单板在发送文件的第一个数据包时传输, 后 续传输过程中, 可以不再传输;
也可以不传输数据包序号 i, 由光模块对接收到的数据包进行计数, 判断 接收到的数据包数;
也可以不传输数据包总数 m给光模块, 由 OTU单板判断是否传输完毕 所有数据包, 或者由 OTU单板在最后一个数据包中携带一结束标识, 指示该 数据包为最后一个数据包, 具体如何判断是否已传输完毕所有数据包的方式 可作种种变形, 本发明对此不作限定。
上述实施例中, 数据包序号也可以使用数据包标识信息替代。
本发明中, 不限于使用 CRC校验对数据包进行校验, 其他校验方法也可 适用, 本发明对此不作限定。 本发明与现有技术相比,由于 OTU单板与光模块之间的程序下载釆用的 接口一般传送速度都很慢, 光模块程序文件稍大(比如 4M )时, 整个文件传 送时间可能需要几十分钟, 整个文件只使用一个 CRC校验码, 万一只有一个 数据包有错, 也需要等到几十分钟后才知道出错, 还不知道到底哪个数据包 有错, 不得不重新传送整个程序文件, 浪费系统资源, 文件下载效率比较低; 本发明对非帧结构通讯接口, 在文件下载阶段引进数据包的概念, 并且将整 个文件的校验机制提前、 细分到每一个数据包, 有利于文件接收者对每一个 数据包进行校验, 能及时发现数据包的传送错误, 及时要求重传, 极大提高 了下载的成功率。 本发明能达到实时校验, 实时要求重传的目的, 在非帧接 口的大文件下载中, 能有效提高下载成功率。
工业实用性 本发明的文件传输方法、 文件发送装置和文件接收装置, 对非帧结构通 讯接口在文件下载阶段弓 I进数据包的概念,并且将整个文件的校验机制提前, 细分到每一个数据包, 有利于文件接收者对每一个数据包进行校验, 能及时 发现数据包的传送错误, 及时要求重传, 极大提高了下载的成功率。 本发明 能达到实时校验, 实时要求重传的目的, 在非帧接口的大文件下载中, 能有 效提高下载成功率。

Claims

权 利 要 求 书
1、 一种文件传输方法, 包括:
文件发送装置将待传输的文件分割成若干个数据包 , 通过非帧结构接口 分别将每个数据包及其校验值发送给文件接收装置;
所述文件接收装置通过所述非帧结构接口接收所述数据包及其校验值, 对所述数据包进行校验, 若校验错误, 则返回接收失败的应答信息给所述文 件发送装置;
所述文件发送装置接收到所述接收失败的应答信息时, 重传对应的数据 包和其校验值给所述文件接收装置。
2、 如权利要求 1所述的方法, 还包括:
若所述文件接收装置对所述数据包校验正确, 则返回接收正确的应答信 息给所述文件发送装置。
3、 如权利要求 2所述的方法, 其中
所述文件发送装置分别将每个数据包及其校验值发送给文件接收装置, 以及, 所述文件发送装置接收到所述接收失败的应答信息时, 重传对应的数 据包和其校验值给所述文件接收装置的步骤包括:
所述文件发送装置将一个数据包及其校验值发送给文件接收装置 , 等待 所述数据包的应答信息;
若所述应答信息为接收正确, 则发送下一数据包给所述文件接收装置; 若所述应答信息为接收失败, 则重传该数据包和其校验值给所述文件接收装 置; 依次类推, 直到发送完毕所有数据包。
4、 如权利要求 1至 3任一项所述的方法, 其中,
所述文件发送装置发送所述数据包的步骤还包括: 发送所述数据包的标 识信息; 所述文件接收装置返回应答信息的步骤中所述应答信息还携带所述 数据包的标识信息;
则, 所述方法还包括: 所述文件发送装置根据所述应答消息中携带的所 述标识信息判断该应答信息对应的数据包。
5、 如权利要求 1至 3任一项所述的方法, 其中,
所述文件接收装置返回应答信息的步骤包括: 所述文件接收装置通过设 置所述非帧结构接口的接收状态返回所述应答信息;
所述文件发送装置接收所述应答信息的步骤包括: 所述文件发送装置通 过读取所述非帧结构接口的接收状态获取所述应答信息。
6、 一种文件发送装置, 包括: 发送单元和状态读取单元, 其中: 所述发送单元设置为: 将待传输的文件分割成若干个数据包, 通过非帧 结构接口分别将所述每个数据包及其校验值发送给文件接收装置, 以及, 接 收到所述状态读取单元获取的应答信息, 若所述应答信息为接收失败的应答 信息, 则重传所述数据包及其校验值给所述文件接收装置; 以及
所述状态读取单元设置为:从所述文件接收装置获取数据包的应答信息, 将所述应答信息发送给所述发送单元。
7、 如权利要求 6所述的文件发送装置, 其中,
所述发送单元是设置为: 发送数据包后, 等待所述数据包的应答信息, 若从所述状态读取单元获取到该数据包的接收正确的应答信息, 则发送下一 数据包及其校验值给所述文件接收装置; 若从所述状态读取单元获取到该数 据包的接收失败的应答信息, 则重传该数据包及其校验值给所述文件接收装 置, 依次类推, 直到发送完毕所有数据包。
8、 如权利要求 6或 7所述的文件发送装置, 其中,
所述发送单元还设置为: 发送的所述数据包还包括标识信息, 以及, 从 所述应答信息中获取所述数据包的标识信息, 根据所述标识信息判断该应答 信息对应的数据包。
9、 如权利要求 6或 7所述的文件发送装置, 其中, 所述状态读取单元是 设置为: 通过读取所述非帧结构接口的接收状态获取所述应答信息, 并将所 述应答信息发送给所述发送单元。
10、 一种文件接收装置, 包括: 接收单元、 校验单元和应答单元, 其中: 所述接收单元设置为通过非帧结构接口接收文件发送装置发送的文件的 若干个数据包及其校验值; 所述校验单元设置为对接收到的所述数据包进行校验, 将校验结果发送 给所述应答单元; 以及
所述应答单元设置为若所述校验结果为校验错误, 则返回接收失败的应 答信息给所述文件发送装置。
11、 如权利要求 10所述的文件接收装置, 其中,
所述应答单元还设置为若校验结果为校验正确, 则返回接收正确的应答 信息给所述文件发送装置。
12、 如权利要求 10或 11所述的文件接收装置, 其中, 所述应答单元还 设置为从接收到的所述数据包中获取所述数据包的标识信息, 并在所述应答 信息中携带所述数据包的标识信息。
13、 如权利要求 10或 11所述的文件接收装置, 其中, 所述应答单元是 设置为通过设置所述非帧结构接口的接收状态返回所述应答信息给所述文件 发送装置。
PCT/CN2010/078835 2010-05-06 2010-11-17 文件传输方法、文件发送装置和文件接收装置 WO2011137640A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201010167342.4 2010-05-06
CN2010101673424A CN102237983A (zh) 2010-05-06 2010-05-06 非帧结构通讯系统中文件传输方法、发送装置和接收装置

Publications (1)

Publication Number Publication Date
WO2011137640A1 true WO2011137640A1 (zh) 2011-11-10

Family

ID=44888247

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2010/078835 WO2011137640A1 (zh) 2010-05-06 2010-11-17 文件传输方法、文件发送装置和文件接收装置

Country Status (2)

Country Link
CN (1) CN102237983A (zh)
WO (1) WO2011137640A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105117253A (zh) * 2015-08-27 2015-12-02 常州大学 一种基于BootLoader的UV LED固化系统远程升级方法

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104579548B (zh) * 2013-10-29 2019-09-10 南京中兴新软件有限责任公司 基于管理数据输入输出多源协议的传输方法及装置
CN104714761B (zh) * 2013-12-16 2018-04-10 航天信息股份有限公司 一种应用Android系统的设备的无线数据打印系统和方法
CN104917586B (zh) * 2014-03-11 2019-06-07 腾讯科技(深圳)有限公司 传输数据的校验方法、装置及系统
CN104486238A (zh) * 2014-12-09 2015-04-01 四川长虹电器股份有限公司 智能电视与移动设备之间大数据交互方法
CN106452679B (zh) * 2016-11-05 2020-11-20 杭州畅动智能科技有限公司 一种机器人开发系统及其通信方法
CN107809423A (zh) * 2017-10-20 2018-03-16 国信嘉宁数据技术有限公司 一种电子证据数据传输方法、系统和设备
CN107820231A (zh) * 2017-11-21 2018-03-20 杨复煦 单向通信器及通信方法
CN110120980B (zh) * 2019-05-27 2021-09-17 牧星机器人(江苏)有限公司 非稳定链路的可靠文件传输方法、计算机设备及存储介质
CN110493302A (zh) * 2019-07-01 2019-11-22 联想(北京)有限公司 一种文件传输方法、设备及计算机可读存储介质
WO2021017527A1 (zh) * 2019-08-01 2021-02-04 青岛海信宽带多媒体技术有限公司 一种光模块数据发送与接收方法、装置及光模块

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6345375B1 (en) * 1999-02-24 2002-02-05 California Amplifier, Inc. Packet-based communication methods and systems having improved data throughput
CN101286867A (zh) * 2007-05-29 2008-10-15 深圳市同洲电子股份有限公司 一种网络设备的软件升级方法与系统
CN101325475A (zh) * 2008-07-10 2008-12-17 中兴通讯股份有限公司 一种嵌入式系统软件远程升级方法
CN101615986A (zh) * 2008-06-27 2009-12-30 华为技术有限公司 一种数据传输方法、装置及通信系统

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6345375B1 (en) * 1999-02-24 2002-02-05 California Amplifier, Inc. Packet-based communication methods and systems having improved data throughput
CN101286867A (zh) * 2007-05-29 2008-10-15 深圳市同洲电子股份有限公司 一种网络设备的软件升级方法与系统
CN101615986A (zh) * 2008-06-27 2009-12-30 华为技术有限公司 一种数据传输方法、装置及通信系统
CN101325475A (zh) * 2008-07-10 2008-12-17 中兴通讯股份有限公司 一种嵌入式系统软件远程升级方法

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105117253A (zh) * 2015-08-27 2015-12-02 常州大学 一种基于BootLoader的UV LED固化系统远程升级方法

Also Published As

Publication number Publication date
CN102237983A (zh) 2011-11-09

Similar Documents

Publication Publication Date Title
WO2011137640A1 (zh) 文件传输方法、文件发送装置和文件接收装置
JP6860826B2 (ja) Ttiバンドリングによるアップリンク送信の強化
CN102546784B (zh) 一种基于can总线进行批量升级设备固件的方法
CN111083161A (zh) 数据传输的处理方法及装置、物联网设备
KR102046792B1 (ko) 송신 노드로부터 목적지 노드로의 데이터 전송 방법
US7031263B1 (en) Method and apparatus for network management system
RU2011108113A (ru) Устройство и способ для формирования протокольного модуля данных мас в системе беспроводной связи
CN112769939B (zh) 一种用于实时通讯的大数据可靠传输方法
CN114268991A (zh) 数据传输方法、装置、电子设备、存储介质
CN111711680A (zh) 基于udp协议的文件断点续传方法及装置
WO2018027814A1 (zh) 一种数据传输方法、数据接收设备及数据发送设备
US7502991B2 (en) Redundant 3-wire communication system
CN1988537A (zh) 一种数据传输协议
CN101453479A (zh) 一种快速的文件传输系统
CN103023602A (zh) 一种基于Socket协议的数据传输容错系统
KR20090094948A (ko) 광대역 무선통신시스템에서 자동 재송 요구 리셋을제어하기 위한 장치 및 방법
US10101987B2 (en) Method and system of processing an image upgrade
WO2011116577A1 (zh) 数据重传方法及装置
EP3764576A1 (en) System and method for implementing a hybrid automatic repeat request process
WO2012155703A1 (zh) 基于hdlc协议的链路参数自协商方法、终端及系统
CN113672545B (zh) 双处理器间电力数据的传输方法和装置
CN117278486A (zh) 一种可靠udp组播的fpga硬件加速系统及方法
TWI231672B (en) SOL realizing method in accordance with IPMI standard
CN117278173A (zh) 一种ota数据的传输系统及车辆
CN113746892A (zh) 一种远程升级方法及无线终端设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 10851009

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 10851009

Country of ref document: EP

Kind code of ref document: A1