Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing the devices, modules or units, and are not used for limiting the devices, modules or units to be different devices, modules or units, and also for limiting the sequence or interdependence relationship of the functions executed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
To make the objects, technical solutions and advantages of the present disclosure more apparent, embodiments of the present disclosure will be described in detail with reference to the accompanying drawings.
The present disclosure provides a data transmission method, an apparatus, an electronic device, and a computer-readable storage medium, which aim to solve the above technical problems of the prior art.
The following describes the technical solutions of the present disclosure and how to solve the above technical problems in specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present disclosure will be described below with reference to the accompanying drawings.
The embodiment of the present disclosure provides a method for data transmission, as shown in fig. 1, the method includes:
step S101: the method comprises the steps that source equipment acquires data to be uploaded, divides the data to be uploaded into at least two fragment data according to a preset threshold value, and distributes identification information for the at least two fragment data;
the source device may be an intelligent device such as a mobile phone and a tablet, and specifically, the source device further includes various clients in the intelligent device, and the data to be uploaded may be multimedia files such as pictures, audio or video.
When data to be uploaded is uploaded, uploading interruption due to network problems sometimes can cause failure of the whole data uploading, which wastes network flow and time. Therefore, the data to be uploaded can be fragmented, for example, as shown in fig. 2, if the size of the data to be uploaded is 2G, the data can be divided into 4 pieces of relatively large fragmented data, each of which is about 500M.
Optionally, identification information may be added to each piece of fragmented data that belongs to the same data to be uploaded, so as to indicate that each piece of fragmented data belongs to the data to be uploaded.
Step S102: uploading at least two fragment data and identification information of the at least two fragment data to a target device based on a preset uploading mode so that the target device synthesizes the received at least two fragment data;
after the data to be uploaded is subjected to fragmentation processing, the fragmentation data subjected to fragmentation processing and the respective identification information of each fragmentation data can be uploaded to the target device by the source device according to a preset uploading mode, so that after the target device receives each fragmentation data, the fragmentation data belonging to the same data to be uploaded can be synthesized according to the respective identification information of each fragmentation data, and the integrity of the data to be uploaded is ensured.
Step S103: if the uploading abnormality of any fragment data is detected, transmitting the abnormality consultation information of any fragment data to the target equipment so as to enable the target equipment to return the abnormal position information of the fragment data;
step S104: and the source equipment uploads the residual data of any fragment data based on the abnormal position information.
It can be understood that, if an exception occurs in the uploading process of any piece of fragmented data, in order to avoid the re-uploading, the exception consultation information of the piece of fragmented data may be sent to the target device to determine where to start the re-uploading. For example, if the source device uploads 300M at point B of fig. 2 and the target device receives only 280M, the target device may return the abnormal location information of the fragmented data according to the abnormal consultation information of the fragmented data sent by the source device. After receiving the abnormal location information of the fragment data, the source device cannot continue to upload the remaining 200M according to point B of fig. 2, but continues to upload the remaining 220M of the fragment data according to the abnormal location information of the fragment data.
According to the embodiment of the disclosure, the data to be uploaded is fragmented, when each piece of data is abnormally transmitted, the abnormal position information of any fragment data is acquired, and the remaining data of the fragment data is continuously uploaded based on the abnormal position information, so that the network traffic is solved, the transmission time is reduced, and the transmission experience of a user is improved. And the identification information is added to each piece of fragment data, so that the target device can synthesize each piece of fragment data according to the identification information, and the integrity of the data is ensured.
The embodiment of the present disclosure provides a possible implementation manner, where uploading at least two pieces of fragment data to a target device based on a preset uploading manner may be to number at least two pieces of fragment data, and sequentially upload at least two pieces of fragment data to the target device based on the number;
or numbering at least two fragment data, and simultaneously uploading the fragment data corresponding to at least two numbers to the target device.
It can be understood that after the source device performs fragmentation processing on the data to be uploaded, each fragment data can be numbered, then each fragment data is sequentially uploaded, and after the target device receives the numbered fragment data, each fragment data can be synthesized according to the number of the fragment data, so that the fragment data is guaranteed against being lost.
Optionally, multiple pieces of fragment data may be uploaded simultaneously to accelerate the uploading time, specifically, multiple pieces of fragment data may be uploaded simultaneously through multiple threads, for example, piece data may be uploaded simultaneously through 2 threads, and thread 1 and thread 2 may upload 500M pieces of fragment data numbered 1 and 2, respectively, simultaneously; after the 500M fragment data with the number of 1 is uploaded by the thread 1, the 500M data with the number of 3 is uploaded, and after the 500M fragment data with the number of 2 is uploaded by the thread 2, the 500M data with the number of 4 is uploaded. Until all the fragmented data are uploaded.
By numbering the fragment data, the fragment data can be ensured not to be lost, and the simultaneous uploading of multiple threads is adopted, so that the uploading speed is further increased, and the uploading time is saved.
The embodiment of the present disclosure provides a possible implementation manner, where any piece of sliced data includes a first cyclic redundancy check crc value of the any piece of sliced data, and after uploading at least two pieces of sliced data to a target device based on a preset uploading manner, the method further includes:
receiving check result information of each piece of fragmented data returned by the target device, wherein the check result information is obtained by the target device through checking each piece of fragmented data respectively based on a first cyclic redundancy check crc value of each piece of fragmented data;
if the verification result information of any piece of fragment data is false, any piece of fragment data is uploaded again;
the checking result information is false, and the second cyclic redundancy check crc value of any piece of fragment data calculated by the target device is different from the first cyclic redundancy check crc value of any piece of fragment data.
It is understood that, in order to ensure the accuracy of data transmission, a Cyclic Redundancy Check (CRC) may be performed on each piece of data in advance, and a first CRC value of each piece of data may be obtained.
Specifically, after receiving each piece of fragment data sent by the source device, the target device also performs cyclic redundancy check on each piece of fragment data, and obtains a second cyclic redundancy check crc value of each piece of fragment data.
When the second cyclic redundancy check crc value of any one piece of fragment data calculated by the target device is the same as the first cyclic redundancy check crc value carried in the uploading of the fragment data, it is indicated that the piece of fragment data is not tampered in the uploading process, the piece of fragment data is correct, and at this time, the check result information of the piece of fragment data returned to the source device is true. The source device does not require additional subsequent operations.
When the second cyclic redundancy check crc value of any one piece of fragment data calculated by the target device is different from the first cyclic redundancy check crc value carried in the uploading of the fragment data, it is indicated that the piece of fragment data is possibly tampered in the uploading process, the piece of fragment data is wrong, the check result information of the piece of fragment data returned to the source device is false, and the source device needs to upload the piece of fragment data again to ensure the accuracy of the piece of fragment data.
Optionally, the source device may further receive the synthetic data ID sent by the target device, which indicates that all the data to be uploaded have been accurately received, and set a feedback mechanism to notify the source device of the uploading condition of the data to be uploaded, so that the user experience can be improved.
Another data transmission method is provided in the embodiments of the present disclosure, and as shown in fig. 3, the method includes:
step S301: receiving at least two fragment data uploaded by a source device based on a preset mode and respective identification information of the at least two fragment data;
step S302: synthesizing the at least two fragment data according to the respective identification information of the at least two fragment data, and generating a synthesized data ID;
in the process of receiving the upload data, if the reception fails due to a problem such as a network, the target device sometimes needs to re-receive. Therefore, the data processed by the fragmentation can be received, for example, as shown in fig. 2, if the size of the data to be received is 2G, the data can be divided into 4 pieces of relatively large fragmentation data, each of which is 500M. Each fragment data can also carry identification information, which indicates that each fragment data belongs to the data to be received.
After receiving the respective fragment data uploaded by the source device in the preset manner and the respective identification information of the respective fragment data, the target device may synthesize the fragment data belonging to the same data to be received according to the respective identification information of the respective fragment data, thereby ensuring the integrity of the data to be uploaded.
Optionally, after the target device synthesizes the fragment data belonging to the data to be received, an ID of the synthesized data may be generated, and then the ID is sent to the source device to complete the feedback.
Step S303: if any fragmented data is received abnormally, receiving abnormal consultation information of any fragmented data sent by source equipment;
step S304: and sending the abnormal position information of any fragment data to the source equipment based on the abnormal consultation information so as to enable the source equipment to upload the residual data of any fragment data.
It can be understood that, if any piece of fragmented data is abnormal in the receiving process, in order to avoid re-uploading, abnormal consultation information of the piece of fragmented data sent by the source device may be received, and then abnormal location information of the piece of fragmented data is sent to the source device, so that the source device determines where to re-upload the remaining data of the piece of fragmented data.
For example, if the source device uploads 300M at point B of fig. 2 and the target device receives only 280M, the target device may return the abnormal location information of the fragmented data according to the abnormal consultation information of the fragmented data sent by the source device. After receiving the abnormal location information of the fragment data, the source device cannot continue to upload the remaining 200M according to point B of fig. 2, but continues to upload the remaining 220M of the fragment data according to the abnormal location information of the fragment data.
According to the embodiment of the disclosure, the respective identification information of the at least two fragment data and the at least two fragment data uploaded by the source device in the preset manner is received, and the two fragment data are synthesized according to the respective identification information of the at least two fragment data, so that the integrity of the synthesized data is ensured, and when any one piece of data is abnormal in transmission, the abnormal position information of any one piece of fragment data is sent to the source device, so that the source device continues to upload the remaining data of the fragment data based on the abnormal position information, the network traffic is solved, the transmission time is reduced, and the transmission experience of a user is improved.
A possible implementation manner is provided in the embodiments of the present disclosure, where any piece of fragmented data includes a first cyclic redundancy check crc value of the any piece of fragmented data;
it is understood that, in order to ensure the accuracy of data transmission, a Cyclic Redundancy Check (CRC) may be performed on each piece of data in advance, and a first CRC value of each piece of data may be obtained.
Optionally, after receiving at least two pieces of fragment data uploaded by the source device based on a preset mode, the method further includes:
checking each fragment data respectively based on the first cyclic redundancy check crc value of each fragment data to generate check result information, and returning the check result information of each fragment data to the source device; and if the verification result information of any piece of fragment data is false, re-receiving the any piece of fragment data.
Wherein, check each piece of data respectively based on the first cyclic redundancy check crc value of each piece of data, include:
and calculating whether the second cyclic redundancy check crc value of each fragment data is the same as the first cyclic redundancy check crc value of the corresponding fragment data.
When the target device receives each fragment data uploaded in a preset uploading mode, the target device can also send verification result information of each fragment data to the source device,
specifically, after receiving each piece of fragmented data sent by the source device, the target device also performs cyclic redundancy check on each piece of fragmented data, and obtains a second cyclic redundancy check crc value of each piece of fragmented data.
When the second cyclic redundancy check crc value of any one piece of fragment data calculated by the target device is the same as the first cyclic redundancy check crc value carried during uploading of the fragment data, it is indicated that the piece of fragment data is not tampered during uploading, the piece of fragment data is correct, at this time, the check result information of the piece of fragment data returned to the source device is true, and the source device does not need additional subsequent operations.
When the second cyclic redundancy check crc value of any one piece of fragment data calculated by the target device is different from the first cyclic redundancy check crc value carried in the uploading of the fragment data, it is indicated that the piece of fragment data is possibly tampered in the uploading process, the piece of fragment data is wrong, the check result information of the piece of fragment data returned to the source device is false, and the source device needs to upload the piece of fragment data again to ensure the accuracy of the piece of fragment data.
An embodiment of the present disclosure provides a data transmission apparatus, and as shown in fig. 4, the data transmission apparatus 40 may include: an acquisition module 401, a first upload module 402, a detection module 403, and a second upload module 404, wherein,
the obtaining module 401 is configured to obtain data to be uploaded by a source device, and divide the data to be uploaded into at least two fragmented data according to a preset threshold; distributing identification information for at least two fragment data;
when data to be uploaded is uploaded, uploading interruption due to network problems sometimes can cause failure of the whole data uploading, which wastes network flow and time. Therefore, the data to be uploaded can be fragmented, for example, as shown in fig. 2, if the size of the data to be uploaded is 2G, the data can be divided into 4 pieces of fragmented data with a larger size, and each piece of fragmented data is 500M.
Optionally, identification information may be added to each piece of fragmented data that belongs to the same data to be uploaded, so as to indicate that each piece of fragmented data belongs to the data to be uploaded.
A first uploading module 402, configured to upload, to a target device, at least two pieces of fragmented data and identification information of each of the at least two pieces of fragmented data based on a preset uploading manner, so that the target device synthesizes the received at least two pieces of fragmented data;
after the data to be uploaded is subjected to fragmentation processing, the fragmentation data subjected to fragmentation processing and the respective identification information of each fragmentation data can be uploaded to the target device by the source device according to a preset uploading mode, so that after the target device receives each fragmentation data, the fragmentation data belonging to the same data to be uploaded can be synthesized according to the respective identification information of each fragmentation data, and the integrity of the data to be uploaded is ensured.
The detection module 403 is configured to send abnormal consultation information of any piece of fragment data to the target device if it is detected that any piece of fragment data is uploaded abnormally, so that the target device returns abnormal position information of the piece of fragment data;
and a second uploading module 404, configured to upload, by the source device, the remaining data of any piece of sliced data based on the abnormal location information.
It can be understood that, if an exception occurs in the uploading process of any piece of fragmented data, in order to avoid the re-uploading, the exception consultation information of the piece of fragmented data may be sent to the target device to determine where to start the re-uploading. For example, if the source device uploads 300M at point B of fig. 2 and the target device receives only 280M, the target device may return the abnormal location information of the fragmented data according to the abnormal consultation information of the fragmented data sent by the source device. After receiving the abnormal location information of the fragment data, the source device cannot continue to upload the remaining 200M according to point B of fig. 2, but continues to upload the remaining 220M of the fragment data according to the abnormal location information of the fragment data.
According to the embodiment of the disclosure, the data to be uploaded is fragmented, when each piece of data is abnormally transmitted, the abnormal position information of any fragment data is acquired, and the remaining data of the fragment data is continuously uploaded based on the abnormal position information, so that the network traffic is solved, the transmission time is reduced, and the transmission experience of a user is improved. And the identification information is added to each piece of fragment data, so that the target device can synthesize each piece of fragment data according to the identification information, and the integrity of the data is ensured.
The embodiment of the present disclosure provides another data transmission apparatus, as shown in fig. 5, the data transmission apparatus 50 may include: a first receiving module 501, a combining module 502, a second receiving module 503, and a sending module 504, wherein,
a first receiving module 501, configured to receive identifier information of at least two pieces of fragment data uploaded by a source device based on a preset manner, where the at least two pieces of fragment data are at least two pieces of fragment data;
a synthesizing module 502, configured to synthesize at least two fragment data according to respective identification information of the at least two fragment data;
in the process of receiving the upload data, if the reception fails due to a problem such as a network, the target device sometimes needs to re-receive. Therefore, the data processed by the fragmentation can be received, for example, as shown in fig. 2, if the size of the data to be received is 2G, the data can be divided into 4 pieces of relatively large fragmentation data, each of which is 500M. Each fragment data can also carry identification information, which indicates that each fragment data belongs to the data to be received.
After receiving the respective fragment data uploaded by the source device in the preset manner and the respective identification information of the respective fragment data, the target device may synthesize the fragment data belonging to the same data to be received according to the respective identification information of the respective fragment data, thereby ensuring the integrity of the data to be uploaded.
Optionally, after the target device synthesizes the fragment data belonging to the data to be received, an ID of the synthesized data may be generated, and then the ID is sent to the source device to complete the feedback.
A second receiving module 503, configured to receive, if any piece of fragmented data is received abnormally, abnormal consultation information of any piece of fragmented data sent by the source device;
a sending module 504, configured to send the abnormal location information of any piece of fragment data to the source device based on the abnormal consultation information, so that the source device uploads the remaining data of any piece of fragment data.
It can be understood that, if any piece of fragmented data is abnormal in the receiving process, in order to avoid re-uploading, abnormal consultation information of the piece of fragmented data sent by the source device may be received, and then abnormal location information of the piece of fragmented data is sent to the source device, so that the source device determines where to re-upload the remaining data of the piece of fragmented data.
For example, if the source device uploads 300M at point B of fig. 2 and the target device receives only 280M, the target device may return the abnormal location information of the fragmented data according to the abnormal consultation information of the fragmented data sent by the source device. After receiving the abnormal location information of the fragment data, the source device cannot continue to upload the remaining 200M according to point B of fig. 2, but continues to upload the remaining 220M of the fragment data according to the abnormal location information of the fragment data.
According to the embodiment of the disclosure, the respective identification information of the at least two fragment data and the at least two fragment data uploaded by the source device in the preset manner is received, and the two fragment data are synthesized according to the respective identification information of the at least two fragment data, so that the integrity of the synthesized data is ensured, and when any one piece of data is abnormal in transmission, the abnormal position information of any one piece of fragment data is sent to the source device, so that the source device continues to upload the remaining data of the fragment data based on the abnormal position information, the network traffic is solved, the transmission time is reduced, and the transmission experience of a user is improved.
Referring now to FIG. 6, a block diagram of an electronic device 600 suitable for use in implementing embodiments of the present disclosure is shown. The electronic devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., car navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
The electronic device includes: a memory and a processor, wherein the processor may be referred to as the processing device 601 hereinafter, and the memory may include at least one of a Read Only Memory (ROM)602, a Random Access Memory (RAM)603 and a storage device 608 hereinafter, which are specifically shown as follows:
as shown in fig. 6, electronic device 600 may include a processing means (e.g., central processing unit, graphics processor, etc.) 601 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage means 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the electronic apparatus 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
Generally, the following devices may be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 607 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 608 including, for example, tape, hard disk, etc.; and a communication device 609. The communication means 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. While fig. 6 illustrates an electronic device 600 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 609, or may be installed from the storage means 608, or may be installed from the ROM 602. The computer program, when executed by the processing device 601, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText transfer protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to:
acquiring data to be uploaded, and dividing the data to be uploaded into at least two fragmented data according to a preset threshold; distributing identification information for at least two fragment data;
uploading the at least two fragment data and the respective identification information of the at least two fragment data to the target device based on a preset uploading mode so that the target device synthesizes the received at least two fragment data;
if the uploading abnormality of any fragment data is detected, transmitting the abnormality consultation information of any fragment data to the target equipment so as to enable the target equipment to return the abnormal position information of the fragment data;
and uploading the residual data of any one piece of fragment data based on the abnormal position information.
Alternatively, the computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to:
receiving respective identification information of at least two fragment data uploaded by a source device based on a preset mode and at least two fragment data;
synthesizing the at least two fragment data according to the respective identification information of the at least two fragment data;
if any fragmented data is received abnormally, receiving abnormal consultation information of any fragmented data sent by source equipment;
and sending the abnormal position information of any fragment data to the source equipment based on the abnormal consultation information so as to enable the source equipment to upload the residual data of any fragment data.
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules or units described in the embodiments of the present disclosure may be implemented by software or hardware. Wherein the designation of a module or unit does not in some cases constitute a limitation of the unit itself.
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to one or more embodiments of the present disclosure, there is provided a data transmission method including:
the method comprises the steps that source equipment acquires data to be uploaded and divides the data to be uploaded into at least two fragmented data according to a preset threshold; distributing identification information for at least two fragment data;
uploading the at least two fragment data and the respective identification information of the at least two fragment data to the target device based on a preset uploading mode so that the target device synthesizes the received at least two fragment data;
if the uploading abnormality of any fragment data is detected, transmitting the abnormality consultation information of any fragment data to the target equipment so as to enable the target equipment to return the abnormal position information of the fragment data;
and the source equipment uploads the residual data of any fragment data based on the abnormal position information.
Optionally, uploading the at least two pieces of fragmented data to the target device based on a preset uploading manner includes any one of:
numbering at least two fragment data, and sequentially uploading the at least two fragment data to target equipment based on the numbering;
and numbering at least two fragment data, and simultaneously uploading the fragment data corresponding to at least two numbers to the target equipment.
Optionally, any piece of sliced data includes a first cyclic redundancy check crc value of the any piece of sliced data.
Optionally, after uploading the at least two pieces of fragmented data to the target device based on the preset uploading manner, the method further includes:
receiving check result information of each piece of fragmented data returned by the target device, wherein the check result information is obtained by the target device through checking each piece of fragmented data respectively based on a first cyclic redundancy check crc value of each piece of fragmented data;
if the verification result information of any piece of fragment data is false, any piece of fragment data is uploaded again;
the checking result information is false, and the second cyclic redundancy check crc value of any piece of fragment data calculated by the target device is different from the first cyclic redundancy check crc value of any piece of fragment data.
According to one or more embodiments of the present disclosure, there is provided a data transmission apparatus including:
the acquisition module is used for acquiring data to be uploaded by the source equipment and dividing the data to be uploaded into at least two fragmented data according to a preset threshold; distributing identification information for at least two fragment data;
the first uploading module is used for uploading the at least two fragment data and the respective identification information of the at least two fragment data to the target equipment based on a preset uploading mode so that the target equipment synthesizes the received at least two fragment data;
the detection module is used for sending abnormal consultation information of any fragment data to the target equipment if the uploading abnormality of any fragment data is detected, so that the target equipment returns the abnormal position information of the fragment data;
and the second uploading module is used for uploading the residual data of any fragment data by the source equipment based on the abnormal position information.
According to one or more embodiments of the present disclosure, there is provided another data transmission method including:
receiving respective identification information of at least two fragment data uploaded by a source device based on a preset mode and at least two fragment data;
synthesizing the at least two fragment data according to the respective identification information of the at least two fragment data;
if any fragmented data is received abnormally, receiving abnormal consultation information of any fragmented data sent by source equipment;
and sending the abnormal position information of any fragment data to the source equipment based on the abnormal consultation information so as to enable the source equipment to upload the residual data of any fragment data.
Optionally, any piece of sliced data includes a first cyclic redundancy check crc value of the any piece of sliced data;
optionally, after receiving at least two pieces of fragment data uploaded by the source device based on a preset mode, the method further includes:
checking each fragment data respectively based on the first cyclic redundancy check crc value of each fragment data to generate check result information, and returning the check result information of each fragment data to the source device;
and if the verification result information of any piece of fragment data is false, re-receiving the any piece of fragment data.
Optionally, the checking the respective fragmented data based on the first cyclic redundancy check crc value of the respective fragmented data respectively includes:
and calculating whether the second cyclic redundancy check crc value of each fragment data is the same as the first cyclic redundancy check crc value of the corresponding fragment data.
According to one or more embodiments of the present disclosure, there is provided another data transmission apparatus, further including:
the first receiving module is used for receiving at least two fragment data uploaded by a source device based on a preset mode and respective identification information of the at least two fragment data;
the synthesis module is used for synthesizing the at least two fragment data according to the respective identification information of the at least two fragment data;
the second receiving module is used for receiving the abnormal consultation information of any fragment data sent by the source equipment if any fragment data is received abnormally;
and the sending module is used for sending the abnormal position information of any fragment data to the source equipment based on the abnormal consultation information so as to enable the source equipment to upload the residual data of any fragment data.
According to one or more embodiments of the present disclosure, there is provided a data transmission electronic device including:
a memory;
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform operations corresponding to the illustrated method of data transfer as disclosed herein.
According to one or more embodiments of the present disclosure, there is provided a data transmission computer-readable storable medium including:
the computer-readable storage medium has stored thereon a computer program which, when executed by a processor, implements the data transmission method shown in the present disclosure.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.