CN102891732A - Data sending method and device and data receiving method and device - Google Patents

Data sending method and device and data receiving method and device Download PDF

Info

Publication number
CN102891732A
CN102891732A CN201210362044XA CN201210362044A CN102891732A CN 102891732 A CN102891732 A CN 102891732A CN 201210362044X A CN201210362044X A CN 201210362044XA CN 201210362044 A CN201210362044 A CN 201210362044A CN 102891732 A CN102891732 A CN 102891732A
Authority
CN
China
Prior art keywords
data
fragment
compact token
transmitted
length
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN201210362044XA
Other languages
Chinese (zh)
Inventor
王亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Star Net Ruijie Networks Co Ltd
Original Assignee
Beijing Star Net Ruijie Networks Co Ltd
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 Beijing Star Net Ruijie Networks Co Ltd filed Critical Beijing Star Net Ruijie Networks Co Ltd
Priority to CN201210362044XA priority Critical patent/CN102891732A/en
Publication of CN102891732A publication Critical patent/CN102891732A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Compression, Expansion, Code Conversion, And Decoders (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the invention provides a data sending method and device and a data receiving method and device. The data sending method comprises the steps of: compressing an initial fragment of data to be transmitted; when the length of the compressed initial fragment is more than a preset value of the length of the initial fragment, adding a mark indicating a compressed state in the compressed initial fragment and sending the compressed initial fragment to the data receiving device, and adding a compressible mark to a data stream ID (Identifier) of the data to be transmitted; or else, adding a mark indicating a non-compression state in the initial fragment and sending the initial fragment to the data receiving device; when the data stream ID of the data to be transmitted includes the compressible mark, compressing subsequent fragments of the data to be transmitted, and adding marks indicating the compressed state in the compressed subsequent fragments; or else, adding marks indicating the non-compression state in the subsequent fragments and sending the subsequent fragments to the data receiving device. According to the embodiment of the invention, by means of compressing the data with good compression effect, the data throughput of a CPU (Central Processing Unit) is reduced, and a large amount of computing resources are saved.

Description

Data transmission method for uplink and device and data receive method and device
Technical field
The present invention relates to the communication technology, relate in particular to a kind of data transmission method for uplink and device and data receive method and device.
Background technology
Develop rapidly along with global economy, the scale of corporate facility is in continuous expansion, therefore each corporate facility is provided with the branch in a plurality of different strange lands on the basis of total portion mechanism, thereby so that daily business datum need to be passed through wide area network (Wide Area Network, WAN) and transmits between total portion mechanism and each branch, between each branch.
At present, before adopting the WAN transmission, transmitting terminal adopts first data compression technique, compress processing to sent data, and then send to WAN, the transfer of data after WAN will compress is to receiving terminal, receiving terminal carries out data decompression to the data after compressing to be processed, thereby obtains data.
Adopt above-mentioned existing data transmission method, need to compress and decompression processing total data at transmitting terminal and receiving terminal, the data processing amount of CPU (Central Processing Unit is called for short CPU) is large, expends a large amount of calculation resources.
Summary of the invention
An aspect of the embodiment of the invention provides a kind of data transmission method for uplink and data receive method, to overcome the defective of prior art, saves calculation resources.
Another aspect of the embodiment of the invention provides a kind of data sending device and data sink, to overcome the defective of prior art, saves calculation resources.
On the one hand, the embodiment of the invention provides a kind of data transmission method for uplink, comprising:
The first fragment of compression data to be transmitted;
When the length of the above first fragment of Length Ratio of the first fragment after the compression during less than preset value, add compact token in the first fragment after described compression and send to data sink, and add compressible mark for the stream identification ID of described data to be transmitted;
When the length of the above first fragment of Length Ratio of the first fragment after the compression during more than or equal to described preset value, in described first fragment, add not compact token and send to described data sink;
When comprising described compressible mark among the data flow ID of described data to be transmitted, the further fragments of compression data to be transmitted is added described compact token and is sent to described data sink in the further fragments after compression;
When not comprising described compressible mark among the data flow ID of described data to be transmitted, in described further fragments, add described not compact token and send to described data sink.
The embodiment of the invention also provides a kind of data receive method, comprising:
The fragment of the data to be transmitted that the receive data dispensing device sends;
When comprising compact token in the described fragment, remove described compact token and decompress(ion), obtain the original segments of described data to be transmitted;
When comprising not compact token in the described fragment, remove described not compact token, obtain the original segments of described data to be transmitted.
On the other hand, the invention provides a kind of data sending device, comprising:
The first compression unit is for the first fragment of compression data to be transmitted; When the length of the above first fragment of Length Ratio of the first fragment after the compression during less than preset value, add compact token in the first fragment after described compression and send to data sink, and add compressible mark for the stream identification ID of described data to be transmitted; When the length of the above first fragment of Length Ratio of the first fragment after the compression during more than or equal to described preset value, in described first fragment, add not compact token and send to described data sink;
The second compression unit is used for when the data flow ID of described data to be transmitted comprises described compressible mark, and the further fragments of compression data to be transmitted is added described compact token and sent to described data sink in the further fragments after compression; When not comprising described compressible mark among the data flow ID of described data to be transmitted, in described further fragments, add described not compact token and send to described data sink.
The embodiment of the invention also provides a kind of data sink, comprising:
Receiving element is used for the fragment of the data to be transmitted that the receive data dispensing device sends;
The decompress(ion) unit is used for removing described compact token and decompress(ion) when described fragment comprises compact token, obtains the original segments of described data to be transmitted; When comprising not compact token in the described fragment, remove described not compact token, obtain the original segments of described data to be transmitted.
The various embodiments described above, first segment by the compression data to be transmitted judges whether and can compress data to be transmitted, when the compression effectiveness of first fragment is good, then the data flow ID with data to be transmitted adds compressible mark, according to this ID the subsequent segments of data to be transmitted is compressed processing, but also all fragments of processing through overcompression are all added compact token, send to data sink, so that data sink carries out decompression processing according to compact token to the fragment that receives; When the compression effectiveness of first fragment is bad, then the data flow ID with data to be transmitted does not add compressible mark, according to this ID the subsequent segments of data to be transmitted is not compressed processing, and the fragment of processing without overcompression all added not compact token, send to data sink, so that data sink does not carry out decompression processing to the fragment that receives according to compact token not.Because the embodiment of the invention is only compressed processing to the good data of compression effectiveness, thereby can reduce the data processing amount of CPU, saves a large amount of calculation resources.
Description of drawings
In order to be illustrated more clearly in the embodiment of the invention or technical scheme of the prior art, the below will do one to the accompanying drawing of required use in embodiment or the description of the Prior Art and introduce simply, apparently, accompanying drawing in the following describes is some embodiments of the present invention, for those of ordinary skills, under the prerequisite of not paying creative work, can also obtain according to these accompanying drawings other accompanying drawing.
Fig. 1 is the flow chart of data transmission method for uplink embodiment one of the present invention;
Fig. 2 is the flow chart of data receive method embodiment one of the present invention;
Fig. 3 is the flow chart of data transmission method embodiment one of the present invention;
Fig. 4 is the structural representation of data sending device embodiment one of the present invention;
Fig. 5 is the structural representation of data sending device embodiment two of the present invention;
Fig. 6 is the structural representation of data sink embodiment one of the present invention;
Fig. 7 is the structural representation of data transmission system embodiment one of the present invention.
Embodiment
For the purpose, technical scheme and the advantage that make the embodiment of the invention clearer, below in conjunction with the accompanying drawing in the embodiment of the invention, technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that obtains under the creative work prerequisite.
Fig. 1 is the flow chart of data transmission method for uplink embodiment one of the present invention, and as shown in Figure 1, the method for present embodiment can comprise:
The first fragment of step 101, compression data to be transmitted;
Particularly, data to be transmitted can be divided into a plurality of messages, at least one message that receives first data to be transmitted is called first fragment, and follow-up at least one message that receives data to be transmitted is called further fragments; Will carry out a precommpression to data to be transmitted in the present embodiment processes, therefore, need first the first fragment of data to be transmitted to be compressed processing, determine the compression effectiveness of first fragment, thereby can reflect the compression effectiveness after whole data to be transmitted is compressed processing.
When the length of first fragment is less than preset value on the Length Ratio of step 102, the first fragment after compressing, add compact token in the first fragment after compression and send to data sink, and add compressible mark for the stream identification ID of data to be transmitted; When the length of first fragment on the Length Ratio of first fragment after the compression greater than or etc. during preset value, in first fragment, add not compact token and send to data sink;
One of ordinary skill in the art will appreciate that, the purpose that data are compressed is exactly for data length is diminished, therefore, preset value is to be not more than certain numerical value of 1, can be the numerical value such as 1,0.9,0.8 such as preset value, wherein, preset value is decided by needed compression effectiveness in each application scenarios, and the present invention does not limit at this.In the present embodiment, be specifically described as 1 take preset value, the length of first fragment is less than 1 on the Length Ratio of the first fragment after the compression, and namely the length of the first fragment after the compression is less than the length of first fragment; The length of first fragment is more than or equal to 1 on the Length Ratio of the first fragment after the compression, and namely the length of the first fragment after the compression is more than or equal to the length of first fragment.Particularly, determine that the compression effectiveness that first fragment is compressed after the processing can compare the length of the first fragment after the compression and the length of first fragment, when the length of the first fragment after the compression during less than the length of first fragment, the compression effectiveness that first fragment then is described is good, therefore, data sink in the first fragment of compression, adds compact token and sends to data sink, so that can carry out decompression processing to the fragment that receives according to compact token; Simultaneously, illustrate that also data waiting for transmission can compress processing, therefore, data flow ID(Identity for data to be transmitted, sign) adds compressible mark, if when receiving again the segment of data to be transmitted, can according to the data flow ID with compressible mark, compress processing to the subsequent segments of data to be transmitted corresponding to this ID.One of ordinary skill in the art will appreciate that, the data flow ID of data to be transmitted determines according to the four-tuple of message, wherein, the four-tuple of message is: source IP, source port, purpose IP and destination interface, the data flow ID of each the transmission of data all is different.
When the length of the first fragment after the compression during more than or equal to the length of first fragment, the compression effectiveness that first fragment then is described is bad, therefore, in first fragment, add not compact token and send to data set, so that data sink does not carry out decompression processing to the first fragment that receives according to compact token not, in order to avoid destroy the accuracy of data; Simultaneously, explanation reply data waiting for transmission are not compressed processing yet, therefore, data flow ID to data to be transmitted does not add compressible mark, if when receiving again the segment of data to be transmitted, can according to the ID that does not have compressible mark, the subsequent segments of data to be transmitted corresponding to this ID not compressed processing.
Step 103, when comprising compressible mark among the data flow ID of data to be transmitted, the further fragments of compression data to be transmitted is added compact token and is sent to data sink in the further fragments after compression; When not comprising compressible mark among the data flow ID of data to be transmitted, in further fragments, add not compact token and send to data sink.
Particularly, when receiving the subsequent segments of data to be transmitted, the further fragments of data to be transmitted is compressed processing still do not compress processing, should judge first whether the data flow ID of data to be transmitted comprises compressible mark.When comprising compressible mark among the data flow ID of data to be transmitted, illustrate that then data to be transmitted can compress processing, therefore, compress the further fragments of the data to be transmitted corresponding with data flow ID data to be transmitted that receive, and add compact token in the further fragments after compression and send to data sink, so that data sink carries out decompression processing according to the further fragments after to the compression that receives of compact token.When not comprising compressible mark among the data flow ID of data to be transmitted, illustrate that then data to be transmitted do not compress processing, therefore, after receiving the subsequent segments corresponding with the data flow ID of data to be transmitted, in subsequent segments, add not compact token and send to data sink, so that data sink does not carry out decompress(ion) to this first fragment that receives according to compact token not, in order to avoid the accuracy of destruction data.
In the present embodiment, first segment by the compression data to be transmitted judges whether and can compress data to be transmitted, when the compression effectiveness of first fragment is good, then the data flow ID with data to be transmitted adds compressible mark, according to this ID the subsequent segments of data to be transmitted is compressed processing, but also all fragments of processing through overcompression are all added compact token, send to data sink, so that data sink carries out decompression processing according to compact token to the fragment that receives; When the compression effectiveness of first fragment is bad, then the data flow ID with data to be transmitted does not add compressible mark, according to this ID the subsequent segments of data to be transmitted is not compressed processing, and the fragment of processing without overcompression all added not compact token, send to data sink, so that data sink does not carry out decompression processing to the fragment that receives according to compact token not.Because the embodiment of the invention is only compressed processing to the good data of compression effectiveness, thereby can reduce the data processing amount of CPU, saves a large amount of calculation resources.
Fig. 2 is the flow chart of data receive method embodiment one of the present invention, and as shown in Figure 2, the method for present embodiment can comprise:
The fragment of the data to be transmitted that step 201, receive data dispensing device send;
Step 202, when comprising compact token in the fragment, remove compact token and decompress(ion), obtain the original segments of data to be transmitted; When comprising not compact token in the fragment, remove not compact token, obtain the original segments of data to be transmitted.
Particularly, after receiving the fragment of the data to be transmitted that data sending device sends, should determine first whether comprise compact token in the fragment of data to be transmitted, when comprising compact token in the fragment of data to be transmitted, the fragment that data to be transmitted then is described is the fragment after overcompression is processed, and therefore, removes first the compact token in the fragment, then the fragment that will remove after the compact token is carried out decompression processing, thereby obtains the original segments of data to be transmitted; When comprising not compact token in the fragment of data to be transmitted, the fragment of then saying data to be transmitted is the fragment of processing without overcompression, therefore, as long as the not compact token in the removal fragment, no longer carry out decompression processing, just can directly obtain the original segments of data to be transmitted.
In the present embodiment, the fragment of the data to be transmitted that sends by the receive data dispensing device then according to the compact token in the fragment of data to be transmitted, is removed after the compact token and is carried out decompression processing, just can obtain the original segments of data to be transmitted; According to the not compact token in the fragment of data to be transmitted, as long as remove not compact token, just can obtain the original segments of data to be transmitted; Because the present invention only carries out decompression processing to the good data of compression effectiveness, thereby can reduce the data processing amount of CPU, saves a large amount of calculation resources.
Fig. 3 is the flow chart of the embodiment one of data transmission method of the present invention.In the embodiment shown in fig. 3, form a complete data transmission procedure by data transmission method for uplink of the present invention shown in Figure 1 and data receive method of the present invention shown in Figure 2, this data transmission procedure is described in detail.As shown in Figure 3, the method for present embodiment can comprise:
Step 301, data sending device obtain the data flow ID of target fragment and the data to be transmitted of data to be transmitted;
Because the data flow ID of data to be transmitted is determined by the four-tuple of message, and a target fragment of data to be transmitted is comprised of at least one message, and the four-tuple that belongs to the message of data to be transmitted all is identical, therefore, a target fragment can represent with the data flow ID of a data to be transmitted.
Step 302, data sending device judge whether target fragment is the first fragment of data to be transmitted;
Present embodiment needs at first first fragment to be carried out the compression effectiveness that precommpression processes to judge data to be transmitted, therefore, need to judge whether the target fragment of obtaining is the first fragment of data to be transmitted, if target fragment is the first fragment of data to be transmitted, direct execution in step 303 then; If target fragment is not the first fragment of data to be transmitted, then explanation has been carried out the precommpression processing to first fragment, then direct execution in step 305.
The first fragment of step 303, data sending device compression data to be transmitted;
Particularly, when target fragment is the first fragment of data to be transmitted, directly first fragment is compressed processing, in the present embodiment, adopt the compression algorithm compression that the first fragment of data to be transmitted is compressed processing, thereby the first fragment after obtaining compressing those having ordinary skill in the art will appreciate that, compression algorithm can be called for short LZO for Lempel-Ziv-Oberhumer() compression algorithm or GNUzip(be called for short: GZIP) compression algorithm etc., the present invention does not limit at this.
When the length of first fragment is less than preset value on the Length Ratio of step 304, the first fragment after compressing, the head of the first fragment of data sending device after compression adds compact token and sends to data sink, and adds compressible mark for the stream identification ID of data to be transmitted; When the length of first fragment on the Length Ratio of first fragment after the compression during more than or equal to preset value, data sending device adds not compact token and sends to data sink at the head of first fragment;
One of ordinary skill in the art will appreciate that, the purpose that data are compressed is exactly for data length is diminished, therefore, preset value is to be not more than certain numerical value of 1, can be the numerical value such as 1,0.9,0.8 such as preset value, wherein, preset value is decided by needed compression effectiveness in each application scenarios, and the present invention does not limit at this.In the present embodiment, be specifically described as 1 take preset value.Particularly, determine that the compression effectiveness that first fragment is compressed after the processing can compare the length of the first fragment after the compression and the length of first fragment, when the length of the first fragment after the compression during less than the length of first fragment, the compression effectiveness that first fragment then is described is good, adds compact token and sends to data sink at the head of the first fragment of this compression; Simultaneously, also add compressible mark for the stream identification ID of data to be transmitted.When the length of the first fragment after this compression during more than or equal to the length of first fragment, illustrate that then the compression effectiveness of first fragment is bad, therefore, add not compact token and send to data sink at the head of first fragment; Simultaneously the stream identification ID of data to be transmitted is left intact.
Need to prove, after step 304, in the time of execution in step 308, can again carry out above-mentioned steps 301, to obtain the further fragments of data to be transmitted.
Step 305, data sending device judge among the data flow ID of data to be transmitted whether comprise compressible mark;
When target fragment is not the first fragment of data to be transmitted, illustrate that then received target fragment is the further fragments of data to be transmitted, the further fragments of data to be transmitted is compressed processing still do not compress processing, should be first according to the data flow ID of data to be transmitted corresponding to the target fragment of obtaining, judge among the data flow ID of data to be transmitted whether comprise compressible mark; When comprising compressible mark among the data flow ID of data to be transmitted, execution in step 306; When not comprising compressible mark among the data flow ID of data to be transmitted, execution in step 307.
The further fragments of step 306, data sending device compression data to be transmitted, the head of the further fragments after compression are added compact token and are sent to data sink;
Particularly, when comprising compressible mark among the data flow ID of data to be transmitted, illustrate that then this data to be transmitted can compress processing, therefore, adopt compression algorithm that the further fragments of the data to be transmitted that receives is compressed processing, further fragments after obtaining compressing, this compression algorithm is identical with the compression algorithm of first fragment being compressed employing; And the head of the further fragments after compression adds compact token and sends to data sink.
Step 307, data sending device are added not compact token and are sent to data sink at the head of further fragments;
Particularly, when not comprising compressible mark among the data flow ID of data to be transmitted, illustrate that then data to be transmitted do not compress processing, therefore, after receiving the subsequent segments of data to be transmitted, add not compact token and send to data sink at the head of subsequent segments.
Preferably, comprise in the above-mentioned compact token: type field and length field, the numerical value of type field is the first value, for example be 1, the present invention does not limit at this, the length of first fragment corresponding to compact token of the numerical value of length field after for compression and the length sum of compact token, therefore, data sink is according to the numerical value 1 of the type field of compact token in the slice header that receives, can determine the fragment that receives is carried out decompress(ion), can also determine whether to have received complete fragment according to the numerical value of length field; Further, also comprised attribute field in the compact token, the numerical value of attribute field is the length of fragment corresponding to the front compact token of compression, therefore, data sink can also judge that whether the fragment of gained behind the decompress(ion) is the fragment before compression corresponding to compact token according to the numerical value of attribute field.Comprise in the above-mentioned not compact token: type field and length field, the numerical value of type field is the second value, for example be 0, the present invention does not limit at this, the numerical value of length field is the length of not further fragments corresponding to compact token and the length sum of compact token not, and therefore, data sink is according to the numerical value 0 of the type field of compact token not in the slice header that receives, can determine the fragment that receives not to be carried out decompression processing, in order to avoid destroy the accuracy of data.Need to prove, compact token and not in the compact token type field be that 1 byte, length field are 4 bytes, further, the attribute field in the compact token is 4 bytes; Therefore, compact token mostly is 9 bytes most, and compact token is not 5 bytes, compact token and not the interpolation of compact token can not have influence on data transfer speed.
Further, the method of present embodiment also comprises: data sending device sends the notification message of the sign carry compression algorithm to data sink so that data sink in the process of the fragment after the compression being carried out decompression processing, adopt with compression process in identical compression algorithm.This step was carried out before step 307 and all can.
Further, the method of present embodiment also comprises: the notification message of the sign of carrying compression algorithm that data sink receive data dispensing device sends, data sink can adopt the compression algorithm that receives that the fragment after compressing is carried out decompression processing, guarantees the accuracy of data.This step was carried out before step 311 and all can.
The fragment of the data to be transmitted that step 308, data sink receive data dispensing device send;
Step 309, data sink judge whether the length of fragment equals the numerical value of length field;
In the present embodiment, after the fragment of the data to be transmitted that the receive data dispensing device sends, the fragment that should determine first received data to be transmitted is a complete fragment whether, if this is just not carry out decompression processing because receive a complete fragment, cause easily data to make mistakes, simultaneously, compact token in the fragment of data to be transmitted or do not included length field in the compact token, therefore, can come according to the numerical value of the length field in this fragment the fragment that receives is judged, judge namely whether the length of fragment equals the numerical value of the length field in the fragment.When the length of fragment equaled the numerical value of the length field in the fragment, then execution in step 310; When the numerical value of the length field in fragment that is uneven in length of fragment, then continue execution in step 308, make the length of fragment equal the numerical value of the length field in the fragment.
Wherein, comprise in the compact token: type field and length field, the numerical value of type field are the first value, for example are 1, the present invention does not limit at this, the length of fragment corresponding to compact token of the data of length field after for compression and the length sum of compact token; Do not comprise in the compact token: type field and length field, the numerical value of type field are the second value, are 0 for example, and the present invention does not limit at this, and the numerical value of length field is not fragment length corresponding to compact token and the length sum of compact token not.
The head of step 310, data sink identification fragment comprises compact token or not compact token;
When the length of fragment equals the numerical value of the length field in the fragment, identify first in the head of fragment and comprise compact token or not compact token, if the head of identification fragment comprises that compact token then needs this fragment is carried out decompression processing, if the head of identification fragment comprises not compact token, then do not need fragment is carried out decompression processing.Particularly, when the numerical value of the type field in the fragment is 1, then comprise compact token in the head of definite this fragment; When the numerical value of type field in the fragment is 0, then comprise not compact token in the head of definite this fragment.
Step 311, when the head of fragment comprises compact token, data sink is removed compact token and decompress(ion), obtains the original segments of data to be transmitted; When the head of fragment comprised not compact token, data sink was removed not compact token, obtains the original segments of data to be transmitted;
Particularly, when determining that according to the numerical value 1 of type field the head of the fragment of data to be transmitted comprises compact token, then remove compact token, and adopt the compression algorithm receive that the fragment of removing after the compact token is carried out decompression processing, thereby obtain the original segments of data to be transmitted.When determining that according to the numerical value 0 of type field the head of the fragment of data to be transmitted comprises not compact token, then remove not compact token, thereby can directly obtain the original segments of data to be transmitted.
Being uneven in length during numerical value in attribute field of the original segments of step 312, the data to be transmitted that obtains when decompress(ion), data sink returns error reporting and stops the fragment of the data to be transmitted that the receive data dispensing device sends to data sending device.
In the present embodiment, further, compact token also comprises attribute field, the numerical value of attribute field is the length of fragment corresponding to the front compact token of compression, therefore, whether the length of the original segments of the data to be transmitted that also needs to determine that decompress(ion) obtains equals the numerical value of attribute field, being uneven in length during numerical value in attribute field of the original segments of the data to be transmitted that obtains when decompress(ion), illustrate that then mistake has appearred in data, should return error reporting and stop the fragment of the data to be transmitted that the receive data dispensing device sends to data sending device, in order to avoid the data of mistake are passed to the user.When the original segments of the data to be transmitted that obtains when decompress(ion) equals the numerical value of attribute field, illustrate that then data are correct.
In the present embodiment, data sending device judges whether compressing data to be transmitted by the first segment of compression data to be transmitted, when the compression effectiveness of first fragment is good, then the data flow ID with data to be transmitted adds compressible mark, according to this ID the subsequent segments of data to be transmitted is compressed processing, but also all heads through the fragment of overcompression processing are all added compact token, and send to data sink; When the compression effectiveness of first fragment is bad, then the data flow ID with data to be transmitted does not add compressible mark, according to this ID the subsequent segments of data to be transmitted is not compressed processing, and the head of the fragment processed without overcompression all added not compact token, and send to data sink.The fragment of the data to be transmitted that data sink receive data dispensing device sends, then according to the type field of the compact token in the fragment of data to be transmitted, remove after the compact token and carry out decompression processing, just can obtain the original segments of data to be transmitted; Type field according to the not compact token in the fragment of data to be transmitted, as long as remove not compact token, just can obtain the original segments of data to be transmitted, because the present invention only compresses and decompression processing the good data to be transmitted of compression effectiveness, thereby can reduce the data processing amount of CPU, save a large amount of calculation resources.Further, by process in compression and the decompress(ion) processing procedure in the identical compression algorithm of employing, and compact token and be not provided with length field in the compact token, and also be provided with attribute field in the compact token, guaranteed accuracy and the reliability of data to be transmitted.
For example in enterprise uses, can often transmit some files, the form of file may have picture (JPG, JPEG, the forms such as BMP), video (WAV, the forms such as AVI), installation kit (EXE form), compressed package (GZ, the forms such as RAR) the different information such as, and these files are that itself is through the data of overcompression, again compress may cause data volume become on the contrary greatly namely again compression be do not have fully resultful, and wasted valuable cpu resource, therefore, we should try one's best and not select to carry out data compression for this file transfer.And some file, such as our WORD document, PPT document, EXCLE document, TXT document etc., these are not through coding, have redundant information, the effect of carrying out data compression is usually relatively good, and we just should select to carry out data compression for this file transfer.The data transmission method for uplink and the data receive method that adopt each embodiment of the invention described above to provide just can effectively solve above-mentioned existing problems.
Fig. 4 is the structural representation of data sending device embodiment one of the present invention, as shown in Figure 4, the device of present embodiment can comprise: the first compression unit 11 and the second compression unit 12, wherein, the first compression unit 11 is used for the first fragment of compression data to be transmitted, when the length of first fragment is less than preset value on the Length Ratio of the first fragment after compressing, add compact token in the first fragment after compression and send to data sink, and add compressible mark for the stream identification ID of data to be transmitted, when the length of first fragment on the Length Ratio of first fragment after the compression during more than or equal to preset value, in first fragment, add not compact token and send to data sink; The second compression unit 12 is used for when the data flow ID of data to be transmitted comprises compressible mark, the further fragments of compression data to be transmitted, add compact token in the further fragments after compression and send to data sink, when not comprising compressible mark among the data flow ID of data to be transmitted, in further fragments, add not compact token and send to data sink.
The device of present embodiment can be for the technical scheme of carrying out embodiment of the method shown in Figure 1, and its realization principle and technique effect are similar, repeat no more herein.
Fig. 5 is the structural representation of data sending device embodiment two of the present invention, and as shown in Figure 5, the device of present embodiment further, can comprise on the basis of apparatus structure shown in Figure 4: acquiring unit 13 and pre-judgement unit 14.Wherein, acquiring unit 13 is used for obtaining the data flow ID of target fragment and the data to be transmitted of data to be transmitted; Pre-judgement unit 14 judges whether target fragment is the first fragment of data to be transmitted, if so, opens described the first compression unit 11, otherwise, open described the second compression unit 12.
Further, above-mentioned the first compression unit 11 concrete first fragments that are used for adopting compression algorithm compression data to be transmitted, also the concrete head that is used for the first fragment after compression adds compact token, and concrete being used for added not compact token at the head of first fragment; Above-mentioned the second compression unit 12 concrete further fragments that are used for adopting compression algorithm compression data to be transmitted, also the concrete head that is used for the further fragments after compression adds compact token, and concrete be used for the head of continuous fragment add not compact token; Wherein, comprise in the compact token: type field and length field, the numerical value of type field are the first value, the length of fragment corresponding to compact token of the numerical value of length field after for compression and the length sum of compact token; Further, this also comprises in compact token: attribute field, and the numerical value of attribute field is the length of fragment corresponding to the front compact token of compression; Do not comprise in the compact token: type field and length field, the numerical value of type field are the second value, and the numerical value of length field is the length of not fragment corresponding to compact token and the length sum of compact token not.The device of present embodiment also comprises: transmitting element 15, wherein, transmitting element 15 is used for sending to data sink the notification message of the sign of carrying compression algorithm.
The device of present embodiment can be for the technical scheme of the data transmission method for uplink of carrying out embodiment of the method shown in Figure 3, and its realization principle and technique effect are similar, repeat no more herein.
Fig. 6 is the structural representation of data sink embodiment one of the present invention, as shown in Figure 6, the device of present embodiment can comprise: receiving element 21 and decompress(ion) unit 22, and wherein, receiving element 21 is used for the fragment of the data to be transmitted of receive data dispensing device transmission; Decompress(ion) unit 22 is used for removing compact token and decompress(ion) when fragment comprises compact token, obtains the original segments of data to be transmitted, when comprising not compact token in the fragment, removes not compact token, obtains the original segments of data to be transmitted.
The device of present embodiment can be for the technical scheme of carrying out embodiment of the method shown in Figure 2, and its realization principle and technique effect are similar, repeat no more herein.
In data sink embodiment two of the present invention, above-mentioned receiving element 21 also is used for the notification message of the sign of carrying compression algorithm of receive data dispensing device transmission, also be used for judging whether the length of described fragment equals the numerical value of length field, if, open decompress(ion) unit 22, otherwise, the fragment of the data to be transmitted that continuation receive data dispensing device sends; The above-mentioned decompress(ion) unit 22 also concrete head that is used for the identification fragment comprises compact token or not compact token, also concrete for adopting the compression algorithm decompress(ion), being uneven in length during numerical value in attribute field of original segments that also is used for the data to be transmitted that obtains when decompress(ion) returned error reporting and stopped the fragment of the data to be transmitted of receive data dispensing device transmission to data sending device; Wherein, comprise in the compact token: type field and length field, the numerical value of type field is the first value, the length of fragment corresponding to compact token of the numerical value of length field after for compression and the length sum of compact token, further, compact token also comprises: attribute field, and the numerical value of attribute field is the length of fragment corresponding to the front compact token of compression; Compact token does not comprise: type field and length field, the numerical value of type field are the second value, and the numerical value of length field is the length of not fragment corresponding to compact token and the length sum of compact token not.
The device of present embodiment can be for the technical scheme of carrying out embodiment of the method data receive method shown in Figure 3, and its realization principle and technique effect are similar, repeat no more herein.
Fig. 7 is the structural representation of data transmission system embodiment one of the present invention, as shown in Figure 7, system in the present embodiment comprises: data sending device 1, data sink 2, WAN3, client 4 and server 5, the solid line between each device represents the communication connection between each device.Data sending device 1 is processed through corresponding compression after obtaining the data that need to send from client 4, data after will processing again send on the wide area network 3, transmission through WAN3 sends to data sink 2, is sent to server 5 by data sink 2 through corresponding decompression processing again.In native system, both reduced the data processing amount of CPU, saved a large amount of calculation resources, reduced again the volume of transmitted data of striding WAN, saved the bandwidth resources of WAN.
Need to prove, about the structure of WAN3, client 4 and server 5, and the communication between each device, one of ordinary skill in the art will appreciate that as with of the prior art consistent, do not do herein and give unnecessary details.
The data sending device 1 that relates in this system and data sink 2 can adopt above-mentioned data sending device and the data sink that embodiment provides that respectively install, and its concrete structure and function and technique effect repeat no more herein.The data transmission method for uplink that this system relates to and data receive method can referring to the flow process of the various embodiments described above, also repeat no more herein.
One of ordinary skill in the art will appreciate that: all or part of step that realizes above-mentioned each embodiment of the method can be finished by the relevant hardware of program command.Aforesaid program can be stored in the computer read/write memory medium.This program is carried out the step that comprises above-mentioned each embodiment of the method when carrying out; And aforesaid storage medium comprises: the various media that can be program code stored such as ROM, RAM, magnetic disc or CD.
It should be noted that at last: above each embodiment is not intended to limit only in order to technical scheme of the present invention to be described; Although with reference to aforementioned each embodiment the present invention is had been described in detail, those of ordinary skill in the art is to be understood that: it still can be made amendment to the technical scheme that aforementioned each embodiment puts down in writing, and perhaps some or all of technical characterictic wherein is equal to replacement; And these modifications or replacement do not make the essence of appropriate technical solution break away from the scope of various embodiments of the present invention technical scheme.

Claims (20)

1. a data transmission method for uplink is characterized in that, comprising:
The first fragment of compression data to be transmitted;
When the length of the above first fragment of Length Ratio of the first fragment after the compression during less than preset value, add compact token in the first fragment after described compression and send to data sink, and add compressible mark for the stream identification ID of described data to be transmitted;
When the length of the above first fragment of Length Ratio of the first fragment after the compression during more than or equal to described preset value, in described first fragment, add not compact token and send to described data sink;
When comprising described compressible mark among the data flow ID of described data to be transmitted, the further fragments of compression data to be transmitted is added described compact token and is sent to described data sink in the further fragments after compression;
When not comprising described compressible mark among the data flow ID of described data to be transmitted, in described further fragments, add described not compact token and send to described data sink.
2. method according to claim 1 is characterized in that,
Adding in the described first fragment after described compression, compact token comprises: the head of the first fragment after described compression adds compact token;
Describedly add not that compact token comprises in described first fragment: the head in described first fragment adds not compact token;
Adding described compact token in the described further fragments after compression comprises: the head of the further fragments after compression adds described compact token;
Describedly add not that compact token comprises in described further fragments: the head in described further fragments adds not compact token.
3. method according to claim 1 and 2 is characterized in that,
Comprise in the described compact token: type field and length field;
The numerical value of described type field is the first value;
The numerical value of described length field is the length of fragment corresponding to the described compact token after compressing and the length sum of described compact token;
Comprise in the described not compact token: described type field and described length field;
The numerical value of described type field is the second value;
The numerical value of described length field is the length of fragment corresponding to described not compact token and the length sum of described not compact token.
4. method according to claim 3 is characterized in that,
Also comprise in the described compact token: attribute field;
The numerical value of described attribute field is the length of fragment corresponding to the front described compact token of compression.
5. require 1 or 2 described methods according to power, it is characterized in that,
The first fragment of described compression data to be transmitted comprises: the first fragment that adopts compression algorithm compression data to be transmitted;
The further fragments of described compression data to be transmitted comprises: the further fragments that adopts described compression algorithm compression data to be transmitted;
Described method also comprises: the notification message that sends the sign of carrying described compression algorithm to described data sink.
6. a data receive method is characterized in that, comprising:
The fragment of the data to be transmitted that the receive data dispensing device sends;
When comprising compact token in the described fragment, remove described compact token and decompress(ion), obtain the original segments of described data to be transmitted;
When comprising not compact token in the described fragment, remove described not compact token, obtain the original segments of described data to be transmitted.
7. method according to claim 6 is characterized in that, after the fragment of the data to be transmitted that described receive data dispensing device sends, also comprises:
The head of identifying described fragment comprises described compact token or described not compact token.
8. method according to claim 7 is characterized in that,
Comprise in the described compact token: type field and length field;
The numerical value of described type field is the first value;
The numerical value of described length field is the length of fragment corresponding to the described compact token after compressing and the length sum of described compact token:
Comprise in the described not compact token: described type field and described length field;
The numerical value of described type field is the second value;
The numerical value of described length field is the length of fragment corresponding to described not compact token and the length sum of described not compact token;
After the fragment of the data to be transmitted that described receive data dispensing device sends, also comprise:
Judge whether the length of described fragment equals the numerical value of described length field;
If, carry out described when comprising compact token in the described fragment, remove described compact token and decompress(ion), obtain the original segments of described data to be transmitted, when comprising not compact token in the described fragment, remove described not compact token, obtain the step of the original segments of described data to be transmitted;
Otherwise, return the step of the fragment of the data to be transmitted that described receive data dispensing device sends.
9. method according to claim 8 is characterized in that,
Also comprise in the described compact token: attribute field;
The numerical value of described attribute field is the length of fragment corresponding to the front described compact token of compression;
The described compact token of described removal and decompress(ion) obtain also comprising after the original segments of described data to be transmitted:
Being uneven in length during numerical value in described attribute field of the original segments of the described data to be transmitted that obtains when decompress(ion) returned error reporting and stopped to receive the fragment of the described data to be transmitted that described data sending device sends to described data sending device.
10. method according to claim 9 is characterized in that, also comprises:
Receive the notification message of the sign of carrying compression algorithm of described data sending device transmission;
Described decompress(ion) comprises: adopt described compression algorithm decompress(ion).
11. a data sending device is characterized in that, comprising:
The first compression unit is for the first fragment of compression data to be transmitted; When the length of the above first fragment of Length Ratio of the first fragment after the compression during less than preset value, add compact token in the first fragment after described compression and send to data sink, and add compressible mark for the stream identification ID of described data to be transmitted; When the length of the above first fragment of Length Ratio of the first fragment after the compression during more than or equal to described preset value, in described first fragment, add not compact token and send to described data sink;
The second compression unit is used for when the data flow ID of described data to be transmitted comprises described compressible mark, and the further fragments of compression data to be transmitted is added described compact token and sent to described data sink in the further fragments after compression; When not comprising described compressible mark among the data flow ID of described data to be transmitted, in described further fragments, add described not compact token and send to described data sink.
12. device according to claim 11 is characterized in that,
Described the first compression unit, the concrete head that is used for the first fragment after described compression adds compact token, and concrete being used for added not compact token at the head of described first fragment;
Described the second compression unit, the concrete head that is used for the further fragments after compression adds described compact token, and concrete being used for added not compact token at the head of described further fragments.
13. according to claim 11 or 12 described devices, it is characterized in that,
Comprise in the described compact token: type field and length field;
The numerical value of described type field is the first value;
The numerical value of described length field is the length of fragment corresponding to the described compact token after compressing and the length sum of described compact token;
Comprise in the described not compact token: described type field and described length field;
The numerical value of described type field is the second value;
The numerical value of described length field is the length of fragment corresponding to described not compact token and the length sum of described not compact token.
14. device according to claim 13 is characterized in that,
Also comprise in the described compact token: attribute field;
The numerical value of described attribute field is the length of fragment corresponding to the front described compact token of compression.
15. according to claim 11 or 12 described devices, it is characterized in that,
Described the first compression unit, the concrete first fragment that is used for adopting compression algorithm compression data to be transmitted;
Described the second compression unit, the concrete further fragments that is used for adopting described compression algorithm compression data to be transmitted;
Described device also comprises: transmitting element is used for carrying the notification message of the sign of described compression algorithm to described data sink transmission.
16. a data sink is characterized in that, comprising:
Receiving element is used for the fragment of the data to be transmitted that the receive data dispensing device sends;
The decompress(ion) unit is used for removing described compact token and decompress(ion) when described fragment comprises compact token, obtains the original segments of described data to be transmitted; When comprising not compact token in the described fragment, remove described not compact token, obtain the original segments of described data to be transmitted.
17. device according to claim 16 is characterized in that,
Described decompress(ion) unit also comprises described compact token or described not compact token for the head of identifying described fragment.
18. device according to claim 16 is characterized in that,
Comprise in the described compact token: type field and length field;
The numerical value of described type field is the first value;
The numerical value of described length field is the length of fragment corresponding to the described compact token after compressing and the length sum of described compact token:
Comprise in the described not compact token: described type field and described length field;
The numerical value of described type field is the second value;
The numerical value of described length field is the length of fragment corresponding to described not compact token and the length sum of described not compact token;
Described receiving element also is used for judging whether the length of described fragment equals the numerical value of described length field; If so, open described decompress(ion) unit; Otherwise, the fragment of the data to be transmitted that continuation receive data dispensing device sends.
19. device according to claim 18 is characterized in that,
Also comprise in the described compact token: attribute field;
The numerical value of described attribute field is the length of fragment corresponding to the front described compact token of compression;
Described decompress(ion) unit also is used for being uneven in length during numerical value in described attribute field of original segments of the described data to be transmitted that obtains when decompress(ion), returns error reporting and stops to receive the fragment of the described data to be transmitted of described data sending device transmission to described data sending device.
20. device according to claim 19 is characterized in that,
Described receiving element also is used for receiving the notification message of the sign of carrying compression algorithm that described data sending device sends;
Described decompress(ion) unit specifically is used for adopting described compression algorithm decompress(ion).
CN201210362044XA 2012-09-25 2012-09-25 Data sending method and device and data receiving method and device Pending CN102891732A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210362044XA CN102891732A (en) 2012-09-25 2012-09-25 Data sending method and device and data receiving method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210362044XA CN102891732A (en) 2012-09-25 2012-09-25 Data sending method and device and data receiving method and device

Publications (1)

Publication Number Publication Date
CN102891732A true CN102891732A (en) 2013-01-23

Family

ID=47535112

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210362044XA Pending CN102891732A (en) 2012-09-25 2012-09-25 Data sending method and device and data receiving method and device

Country Status (1)

Country Link
CN (1) CN102891732A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107294878A (en) * 2016-04-13 2017-10-24 中国移动通信有限公司研究院 Data transmission method, system and relevant device
CN111178490A (en) * 2019-12-31 2020-05-19 北京百度网讯科技有限公司 Data output method, data acquisition method, data output device, data acquisition device and electronic equipment
CN113193873A (en) * 2021-04-07 2021-07-30 深圳市华星光电半导体显示技术有限公司 Encoding method, decoding method, encoding device, and decoding device

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101552652A (en) * 2009-05-13 2009-10-07 北京交大思源科技有限公司 A document transmission method and transmission device

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101552652A (en) * 2009-05-13 2009-10-07 北京交大思源科技有限公司 A document transmission method and transmission device

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107294878A (en) * 2016-04-13 2017-10-24 中国移动通信有限公司研究院 Data transmission method, system and relevant device
CN111178490A (en) * 2019-12-31 2020-05-19 北京百度网讯科技有限公司 Data output method, data acquisition method, data output device, data acquisition device and electronic equipment
KR20210086936A (en) * 2019-12-31 2021-07-09 베이징 바이두 넷컴 사이언스 앤 테크놀로지 코., 엘티디. Data output method, data acquisition method, device, and electronic equipment
CN111178490B (en) * 2019-12-31 2021-08-24 北京百度网讯科技有限公司 Data output method, data acquisition method, data output device, data acquisition device and electronic equipment
US11562241B2 (en) 2019-12-31 2023-01-24 Beijing Baidu Netcom Science and Technology Co., Ltd Data output method, data acquisition method, device, and electronic apparatus
KR102542239B1 (en) * 2019-12-31 2023-06-12 베이징 바이두 넷컴 사이언스 앤 테크놀로지 코., 엘티디. Data output method, data acquisition method, device, and electronic equipment
CN113193873A (en) * 2021-04-07 2021-07-30 深圳市华星光电半导体显示技术有限公司 Encoding method, decoding method, encoding device, and decoding device

Similar Documents

Publication Publication Date Title
US7925856B1 (en) Method and apparatus for maintaining an amount of reserve space using virtual placeholders
CN114201421B (en) Data stream processing method, storage control node and readable storage medium
US11023412B2 (en) RDMA data sending and receiving methods, electronic device, and readable storage medium
CN112822260B (en) File transmission method and device, electronic equipment and storage medium
US11899624B2 (en) System and method for random-access manipulation of compacted data files
CN102891732A (en) Data sending method and device and data receiving method and device
CN108133026B (en) Multi-data processing method, system and storage medium
CN111414339B (en) File processing method, system, device, equipment and medium
CN113238856A (en) RDMA (remote direct memory Access) -based memory management method and device
CN108632321A (en) Treating method and apparatus based on scheduling of resource under big data platform
US10673801B2 (en) Dynamic communication session management
CN112953988B (en) Data docking method and device based on FTP
CN110309191B (en) Method, device and system for storing business data
CN112055058A (en) Data storage method and device and computer readable storage medium
CN117061072B (en) Message transmission method, device, equipment and storage medium
US20140330798A1 (en) VDI File Transfer Method and Apparatus
CN115878351B (en) Message transmission method and device, storage medium and electronic device
CN114827130B (en) File uploading method and device
CN114363428B (en) Socket-based data transmission method
WO2023174040A1 (en) Picture processing method and related device
CN108304214B (en) Method and device for verifying integrity of immediate data
CN116489205A (en) Data transmission method and related equipment
CN115834575A (en) Log reporting method, system, equipment and computer readable storage medium
CN115250257A (en) Ethernet message processing method and device applied to DPU
CN115664826A (en) Data file encryption method and device, computing equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20130123