Data transmission method, data receiving method, computer equipment, readable storage medium and program product

By fragmenting data into batches below a transmission threshold and verifying content, the method addresses data transmission failures between browser pages and local operating systems, improving the success and reliability of data delivery.

CN119232727APending Publication Date: 2024-12-31TENCENT MUSIC ENTERTAINMENT TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411425144.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

Data transmission between browser pages and local operating systems often fails due to size limitations, leading to incomplete or failed transfers of data, particularly with larger files.

Method used

The data is divided into multiple fragments, each below a predetermined threshold, and transmitted in batches to ensure each fragment adheres to the transmission limit, accompanied by content verification to ensure accuracy and reliability.

Benefits of technology

This method enhances the success rate of data transmission by overcoming size limitations, ensuring accurate and reliable delivery of larger data files between browser pages and local operating systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119232727A_ABST
    Figure CN119232727A_ABST
Patent Text Reader

Abstract

The invention relates to a data transmission method, a data receiving method, computer equipment, a computer readable storage medium and a computer program product, relates to the technical field of computers, and can improve the success rate of data transmission between a browser page and a terminal local operating system. The data transmission method comprises the following steps: determining the data size of target data to be transmitted between a browser page and a home terminal operating system; under the condition that the data size of the target data exceeds a data transmission threshold value, segmenting the target data by the data sender to obtain a plurality of data fragments; transmitting the plurality of data fragments to a data receiver in the browser page and a home terminal operating system in batches, so that the data receiver obtains target data according to the plurality of data fragments obtained in batches; the data size of the data fragment transmitted each time does not exceed a data transmission threshold value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a data transmission method, a data receiving method, a computer device, a computer-readable storage medium, and a computer program product. Background Art

[0002] With the development of computer technology, terminal applications are widely used in many fields. Since browser web pages are highly flexible and dynamic, and can efficiently adapt to different usage requirements in terms of content presentation and interaction methods, browser web pages are often embedded in terminal applications for display.

[0003] In order to ensure the normal display of browser web pages, in the related art, the browser page embedded in the terminal application and the local operating system of the terminal will call each other, and data will be transmitted between the browser page and the local operating system of the terminal during the call. However, the inventors have found in practice that the data transmission between the browser page and the local operating system of the terminal often fails. Summary of the invention

[0004] Based on this, it is necessary to provide a data transmission method, data receiving method, computer device, computer-readable storage medium and computer program product that can improve the success rate of data transmission between browser pages and terminal local operating systems in response to the above technical problems.

[0005] In a first aspect, the present application provides a data transmission method, which is applied to a data sender in a browser page and a local operating system, comprising:

[0006] Determine the data size of target data to be transmitted between the browser page and the local operating system;

[0007] When the data size of the target data exceeds the data transmission threshold, the data sender divides the target data into multiple data fragments; the data transmission threshold is determined based on the data size during normal data transmission between the browser page and the local operating system;

[0008] The multiple data slices are transmitted in batches to the browser page and the data receiver in the local operating system, so that the data receiver obtains the target data according to the multiple data slices obtained in batches; the data size of the data slice transmitted each time does not exceed the data transmission threshold.

[0009] In one embodiment, the transmitting of the plurality of data fragments to the browser page and the data receiving party in the local operating system in batches includes:

[0010] Extracting a first fragment content feature corresponding to each of the data fragments;

[0011] For each of the data slices, associating the first slice content feature with the data slice to obtain a data block corresponding to the data slice;

[0012] Transmitting multiple data blocks to the browser page and the data receiver in the local operating system in batches to trigger the data receiver to extract the second fragment content feature corresponding to the data fragment in the data block, and after determining that the fragment verification has passed according to each of the first fragment content features and each of the second fragment content features, obtaining the target data based on the data fragment in each of the data blocks.

[0013] In one embodiment, extracting the first fragment content feature corresponding to each of the data fragments includes:

[0014] For each of the data slices, obtain the slice length of the data slice, and obtain the slice hash value corresponding to the data slice based on a preset digest algorithm;

[0015] Based on the slice length and the slice hash value corresponding to each of the data slices, a first slice content feature corresponding to each of the data slices is obtained.

[0016] In one of the embodiments, before transmitting the plurality of data fragments to the browser page and the data receiving party in the local operating system in batches, the method further includes:

[0017] Acquire a first overall content feature corresponding to the target data;

[0018] A block transmission indication carrying the first overall content feature is transmitted to the browser page and the data recipient in the local operating system; the block transmission indication is used to instruct the data recipient to combine the multiple data fragments obtained in batches, determine the second overall content feature corresponding to the combined multiple data fragments, and determine the combined multiple data fragments as the target data when the second overall content feature matches the first overall content feature.

[0019] In one embodiment, the obtaining the first overall content feature corresponding to the target data includes:

[0020] Obtaining the overall data length of the target data, and obtaining the overall data hash value corresponding to the target data based on a preset digest algorithm;

[0021] Based on the overall data length and the overall data hash value, a first overall content feature corresponding to the target data is obtained.

[0022] In one embodiment, the transmitting of the plurality of data fragments to the browser page and the data receiving party in the local operating system in batches includes:

[0023] For each of the data slices, obtaining a slice order of the data slice among the multiple data slices, and associating the slice order with the data slice;

[0024] The multiple data slices associated with the corresponding slice order are transmitted in batches to the browser page and the data receiving party in the local operating system, so that the data receiving party combines the multiple data slices in sequence according to the slice order associated with each data slice obtained in batches.

[0025] In a second aspect, the present application further provides a data receiving method, which is applied to a data receiving party in a browser page and a local operating system, and the method comprises:

[0026] The data sender in the receiving browser page and the local operating system transmits multiple data slices to the data receiver in batches; the multiple data slices are obtained by the data sender by segmenting the target data after determining that the data size of the target data exceeds a data transmission threshold, the data transmission threshold is determined based on the data size when the data is normally transmitted between the browser page and the local operating system, and the data size of the data slice transmitted by the data sender each time does not exceed the data transmission threshold;

[0027] The target data is acquired according to the multiple data slices.

[0028] In one of the embodiments, the received plurality of data slices are respectively associated with respective first slice content features;

[0029] The acquiring the target data according to the plurality of data slices comprises:

[0030] For each of the received data slices, extract a second slice content feature corresponding to the data slice, and determine that the data slice has passed verification if the second slice content feature matches the first slice content feature;

[0031] The target data is obtained according to each of the data slices that have passed the verification.

[0032] In one embodiment, before the step of acquiring the target data according to the plurality of data slices, the method further includes:

[0033] receiving a block transmission indication transmitted by the data sending party to the data receiving party; the block transmission indication carries a first overall content feature corresponding to the target data;

[0034] Combining the multiple data fragments obtained in batches, and determining the second overall content features corresponding to the combined multiple data fragments;

[0035] When the second overall content feature matches the first overall content feature, the combined plurality of data fragments are determined as the target data.

[0036] In a third aspect, the present application also provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, it implements the steps of any of the above data transmission methods or any of the above data receiving methods.

[0037] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the data transmission method described in any one of the above items or the steps of the data receiving method described in any one of the above items are implemented.

[0038] In a fifth aspect, the present application also provides a computer program product, comprising a computer program, which, when executed by a processor, implements the steps of any of the above data transmission methods or any of the above data receiving methods.

[0039] The above-mentioned data transmission method, data receiving method, computer device, computer-readable storage medium and computer program product can determine the data size of the target data to be transmitted between the browser page and the local operating system; when the data size of the target data exceeds the data transmission threshold, the data sender in the browser page and the local operating system divides the target data to obtain multiple data fragments, and the data transmission threshold is determined based on the data size when the data is normally transmitted between the browser page and the local operating system, and then the multiple data fragments can be transmitted to the data receiver in the browser page and the local operating system in batches, so that the data receiver obtains the target data according to the multiple data fragments obtained in batches, wherein the data size of each transmitted data fragment does not exceed the data transmission threshold. In this embodiment, by dividing the data size of the target data to be transmitted between the browser page and the local operating system into multiple data fragments, and sending the data fragments to the data receiver in the browser page and the local operating system in batches, it is possible to break through the data size limit, solve the problem of limited transmission between the browser page and the local operating system, and transmit larger files or content to the local operating system or browser page while ensuring normal data transmission, thereby improving the transmission success rate of various sizes of data between the browser page and the terminal local operating system, and helping to expand the applicable scenarios of the browser page. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0041] Figure 1 An application environment diagram of a data transmission method in an embodiment;

[0042] Figure 2 A schematic diagram of a data transmission method in an embodiment;

[0043] Figure 3 A schematic diagram of a flow chart of steps for acquiring and transmitting a data block in one embodiment;

[0044] Figure 4 A schematic diagram of a flow chart of a data receiving method in an embodiment;

[0045] Figure 5 A schematic diagram of a flow chart of a step of verifying a data block in one embodiment;

[0046] Figure 6is a schematic diagram of a combined data slice in one embodiment;

[0047] Figure 7 A schematic diagram of a process of receiving data blocks by a host platform in one embodiment;

[0048] Figure 8 The figure is a diagram of the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0050] The data transmission method provided in the embodiments of the present application can, in some embodiments, be applied to Figure 1 In the application environment shown, the application environment includes a browser page and an operating system on the same terminal, wherein the browser page is also referred to as a web page, and the operating system on the same terminal as the browser page is also referred to as a local operating system or a host platform. For example, the local operating system may include an Android system or an iOS system. In the application environment, the browser page may run in a kernel process different from the process where the local operating system is located, and the browser page and the local operating system may call each other. For example, the browser page may obtain login state information by calling the local operating system to display the browser page normally, or may obtain the expansion capability provided by the local operating system by calling the interface provided by the local operating system. In the process of calling each other, data transmission will be performed between the browser page and the local operating system, and one of the browser page and the local operating system serves as a data sender and the other as a data receiver. Specifically, if the browser page is a data sender, the local operating system is a data receiver, and if the local operating system is a data sender, the browser page is a data receiver.

[0051] The data transmission method provided in the present application can be applied to the data sender in the browser page and the local operating system. In the method, the data size of the target data to be transmitted between the browser page and the local operating system can be determined first. When the data size of the target data exceeds the data transmission threshold, the data sender divides the target data into multiple data slices, and the data transmission threshold is determined based on the data size when the data transmission is normally performed between the browser page and the local operating system; then the data sender transmits the multiple data slices in batches to the browser page and the data receiver in the local operating system, so that the data receiver obtains the target data according to the multiple data slices obtained in batches; wherein the data size of the data slice transmitted each time does not exceed the data transmission threshold.

[0052] The terminal may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. Head-mounted devices may be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. The server 104 may be an independent physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides cloud computing services.

[0053] In an exemplary embodiment, Figure 2 As shown, a data transmission method is provided, which is described by taking the method applied to a browser page and a data sender in a local operating system as an example, and includes the following steps S201 to S203. Among them:

[0054] S201, determining the data size of target data to be transmitted between the browser page and the local operating system.

[0055] The local operating system is the operating system on the same terminal as the browser page.

[0056] In the related art, the browser page embedded in the terminal application and the local operating system of the terminal will call each other, and data will be transmitted between the browser page and the local operating system of the terminal during the call. However, the data transmission often fails. After a lot of exploration and testing, the inventor found that there is a size limit for data transmission between the browser page and the local operating system of the terminal. When the size of the data to be transmitted is too large, the data transmission between the browser page and the operating system is prone to fail. For example, when a picture or a file needs to be transmitted, the transmission often fails.

[0057] In this regard, in this embodiment, the data sender may first determine the size of the data to be transmitted between the browser page and the local operating system. For ease of distinction, the data subsequently transmitted to the data receiver is referred to as target data.

[0058] S202, when the data size of the target data exceeds the data transmission threshold, the data sender divides the target data into multiple data fragments; the data transmission threshold is determined based on the data size during normal data transmission between the browser page and the local operating system.

[0059] In practical applications, a data transmission threshold can be obtained in advance, and the data transmission threshold is determined based on the data size when data is normally transmitted between the browser page and the local operating system. Specifically, test data of different sizes can be used to perform data transmission tests between the browser page and the local operating system to determine whether test data of different sizes can be normally transmitted between the browser page and the local operating system, and obtain corresponding test results. Then, the data size when data is normally transmitted between the browser page and the local operating system can be determined based on the test results, and then the data transmission threshold is determined based on the data size, wherein the data transmission threshold is less than or equal to the data size when data is normally transmitted. In some examples, when a parameter of a certain length needs to be added when sending data, the data transmission threshold can be determined based on the parameter length and the data size when data is normally transmitted, such as the sum of the data transmission threshold and the parameter length does not exceed the data size when data is normally transmitted.

[0060] In some embodiments, the data transmission threshold used when the browser page transmits data to the local operating system may be the same as or different from the data transmission threshold used when the local operating system transmits data to the browser page. For example, the data transmission process of transmitting data from the browser page to the local operating system and the data transmission process of transmitting data from the local operating system to the browser page can be tested separately to obtain respective test results, and the data transmission thresholds can be determined separately according to the respective test results.

[0061] In some embodiments, corresponding data transmission thresholds can be defined for different services. For example, data transmission thresholds can be set for different types of data based on the type of data transmitted between the browser page and the local operating system. For example, when transmitting file type data, the data transmission threshold is A1, and when transmitting message type data, the data transmission threshold is A2.

[0062] In this step, the data size of the target data can be compared with the data transmission threshold. When the data size of the target data does not exceed the data transmission threshold, it can be determined that the target data can be normally transmitted between the browser page and the local operating system. When the data size of the target data exceeds the data transmission threshold, it can be determined that directly sending the target data is likely to cause an exception. In this regard, the data sender can divide the target data into multiple data slices, so that the data size of each data slice obtained does not exceed the data transmission threshold.

[0063] S203, transmitting multiple data slices in batches to the browser page and the data receiving party in the local operating system, so that the data receiving party obtains the target data according to the multiple data slices obtained in batches; the data size of each transmitted data slice does not exceed the data transmission threshold.

[0064] Furthermore, after the data sender obtains multiple data slices that do not exceed the data transmission threshold, it can send multiple data slices to the browser page and the party serving as the data receiver in the local operating system in batches. After obtaining the multiple data slices, the data receiver can obtain the target data based on the multiple data slices. Each time a data slice is transmitted, the total data size of each data slice transmitted does not exceed the data threshold. For example, if the total data size of the target data to be transmitted is M bytes, and the data transmission threshold is 1M, that is, 1048576 bytes, the data sender will cut the target data into N blocks, where N is determined as follows:

[0065] N = round up (M / 1048576) + 1:

[0066] If the total size of the target data is 3146752 bytes, then 3146752 / 1048576=3.0009765625, which is rounded to 3, so N = 3+1, that is, the target data is divided into 4 data slices for data transmission. Since the maximum value of the data slice data size can be equal to the data transmission threshold during segmentation, only one data slice can be transmitted in each subsequent transmission. In other embodiments, if the maximum value of the data slice data size is less than the data transmission threshold, for example, the maximum value x of the data slice data size is 1 / m of the data transmission threshold, it can be considered to send no more than m data slices to the data recipient in each transmission to avoid exceeding the data transmission threshold.

[0067] The above data transmission method can determine the data size of the target data to be transmitted between the browser page and the local operating system; when the data size of the target data exceeds the data transmission threshold, the data sender in the browser page and the local operating system divides the target data to obtain multiple data fragments, and the data transmission threshold is determined based on the data size when the data is normally transmitted between the browser page and the local operating system, and then the multiple data fragments can be transmitted to the data receiver in the browser page and the local operating system in batches, so that the data receiver obtains the target data according to the multiple data fragments obtained in batches, wherein the data size of each transmitted data fragment does not exceed the data transmission threshold. In this embodiment, by dividing the data size of the target data to be transmitted between the browser page and the local operating system into multiple data fragments, and sending the data fragments to the data receiver in the browser page and the local operating system in batches, it is possible to break through the data size limit, solve the problem of limited transmission between the browser page and the local operating system, and transmit larger files or content to the local operating system or browser page while ensuring normal data transmission, thereby improving the transmission success rate of various sizes of data between the browser page and the terminal local operating system, and helping to expand the applicable scenarios of the browser page.

[0068] In one embodiment, step S203, transmitting multiple data segments to the browser page and the data receiver in the local operating system in batches, may include the following steps:

[0069] S2031, extracting the first fragment content feature corresponding to each data fragment.

[0070] In actual applications, during the transmission of data shards, the data content in the data shards may be lost or tampered with. In this embodiment, the data sender can extract features of the content of the data shards in advance to obtain shard content features corresponding to the data shards. For the convenience of distinction, the shard content features extracted by the data sender are called first shard content features.

[0071] S2032: For each data shard, associate the first shard content feature with the data shard to obtain a data block corresponding to the data shard.

[0072] Furthermore, for each data shard, the first shard content feature may be associated with the data shard, and a corresponding data block may be obtained based on the data shard associated with the first shard content feature.

[0073] S2033, transmitting multiple data blocks to the browser page and the data receiver in the local operating system in batches to trigger the data receiver to extract the second fragment content feature corresponding to the data fragment in the data block, and after determining that the fragment verification has passed according to each first fragment content feature and each second fragment content feature, obtaining the target data based on the data fragment in each data block.

[0074] After the data sender obtains multiple data blocks, the multiple data blocks can be transmitted to the data receiver in the browser page and the local operating system in batches. For example, if the data sender is a browser page, the browser page can transmit multiple data blocks to the local operating system in batches, and send one data block in each transmission. For each data block received, the data receiver can first verify the accuracy of the fragment content in the data block. Specifically, the data receiver can extract features of the data fragments in the data block to obtain corresponding fragment content features. For the convenience of distinction, the fragment content features extracted by the data receiver are called second fragment content features. Then, the second fragment content features can be compared with the first fragment content features. If the second fragment content features match the first fragment content features, for example, the two are the same, it can be determined that the corresponding data fragments have passed the verification. After the data receiver verifies the data fragments in each data block and each data fragment passes the verification, the data receiver can obtain the target data based on the data fragments in each data block.

[0075] In this embodiment, the data sender in the browser page and the local operating system sends a data block carrying the first fragment content feature to the data receiver, so that the data receiver can perform content verification on the data fragments in each received data block according to the first fragment content feature and the second fragment content feature extracted by the data receiver, and then obtain the corresponding target data after ensuring that each data fragment is correct. While breaking through the transmission limit of the target data on the data size, it also effectively guarantees the transmission accuracy and reliability of the target data between the browser page and the local operating system.

[0076] In one embodiment, in step S2031, extracting the first fragment content feature corresponding to each data fragment may include the following steps:

[0077] For each data shard, the shard length of the data shard is obtained, and the shard hash value corresponding to the data shard is obtained based on a preset summary algorithm; based on the shard length and shard hash value corresponding to each data shard, the first shard content feature corresponding to each data shard is obtained.

[0078] Specifically, after the target data is segmented and multiple data segments are obtained, for each data segment, the data sender can determine the segment length of the data segment, where the segment length indicates the amount of data contained in the data segment. In some examples, the segment length can also be referred to as the content length of the data segment, and its unit is bytes.

[0079] On the other hand, the hash value of the data shard can be obtained. For the convenience of distinction, the hash value of the data shard is called the shard hash value. Specifically, in some cases, the shard length of the data shard may remain unchanged but the data content may change. In view of this situation, the present embodiment can also use a preset digest algorithm to obtain the shard hash value of the data shard. The shard hash value changes accordingly with any change in the content of the data shard, that is, as long as the content of the data shard changes slightly, the shard hash value also changes accordingly, so that it can be judged by the shard hash value whether the content of the data shard has changed. In some embodiments, the digest algorithm can be the MD5 information digest algorithm, which is a cryptographic hash function that can be used to generate a hash value of a preset length (such as 16 bytes).

[0080] After obtaining the slice length and the slice hash value of the data slice, the data sender can obtain the first slice content feature corresponding to each data slice based on the slice length and the slice hash value corresponding to the data slice.

[0081] It is understandable that the process of extracting the second shard content feature by the data receiver can be similar to the process of extracting the first shard content feature by the data sender. For example, if the data sender determines the first shard content feature based on the shard length and the shard hash value, the data receiver can obtain the shard length and the shard hash value of the data shard in the data block to obtain the second shard content feature; if the data sender determines the first shard content feature only based on the shard length or the shard hash value, the data receiver can obtain the shard length or the shard hash value of the data shard in the data block as the second shard content feature.

[0082] In this embodiment, the first fragment content feature corresponding to the data fragment is obtained based on the fragment length and the fragment hash value, so that the data recipient can quickly verify whether the fragment content of the data fragment is missing or tampered with, and quickly obtain the fragment content verification result, thereby effectively ensuring the data transmission efficiency between the browser page and the local operating system.

[0083] In one embodiment, before step S203, the method may further include the following steps:

[0084] Acquire a first overall content feature corresponding to the target data; transmit a block transmission instruction carrying the first overall content feature to a data receiver in a browser page and a local operating system; the block transmission instruction is used to instruct the data receiver to combine multiple data fragments obtained in batches, determine the second overall content feature corresponding to the combined multiple data fragments, and determine the combined multiple data fragments as target data when the second overall content feature matches the first overall content feature.

[0085] Specifically, in this embodiment, the data sender can extract content features of the target data as a whole to obtain the overall content features corresponding to the target data. For the sake of distinction, the overall content features obtained by the data sender are referred to as first overall content features. Whether the target data has changed can be determined by the overall content features.

[0086] Then, the data sender can transmit a block transmission instruction carrying the first overall content feature to the browser page and the data receiver in the local operating system. For example, the control interface sendContent for block transmission can be pre-defined, and the data sender can send a block transmission instruction carrying the first overall content feature by calling sendContent. On the one hand, by sending a block transmission instruction to the data receiver, the data receiver can be informed that the data block transmission will be carried out later, and the data receiver can be prompted in advance that the multiple data fragments received later are associated, so as to avoid the data receiver from splitting the multiple data fragments for use, thereby ensuring the normal data communication.

[0087] On the other hand, the block transmission indication carries the first overall content feature. When the data receiving party obtains the relevant multiple data fragments according to the block transmission indication, in addition to receiving the subsequent multiple associated data fragments and combining the multiple data fragments, the data receiving party can also extract the content features of the combined multiple data fragments to obtain the corresponding overall content features. For the convenience of distinction, the overall content feature is called the second overall content feature. Although the data receiving party can normally obtain multiple data fragments, different combinations may affect the accuracy of the final combined data. In this regard, by comparing the second overall content feature with the first overall content feature, it can be determined whether the data receiving party has correctly restored the target data. If the second overall content feature matches the first overall content feature, for example, the two are the same, the combined multiple data fragments can be determined as the target data fragments. If the second overall content feature does not match the first overall content feature, it can be determined that an abnormality occurs in the data fragment combination process, and the current combined multiple data fragments are not equivalent to the target data.

[0088] In this embodiment, by transmitting a block transmission indication carrying the first overall content feature to the data recipient in the browser page and the local operating system, on the one hand, the data recipient can be prompted to start receiving multiple associated data fragments, and on the other hand, the data recipient can be helped to quickly verify the accuracy of the combination of multiple data fragments, thereby improving the accuracy of data transmission between the browser page and the local operating system.

[0089] In one embodiment, obtaining the first overall content feature corresponding to the target data may include the following steps:

[0090] The overall data length of the target data is obtained, and the overall data hash value corresponding to the target data is obtained based on a preset digest algorithm; based on the overall data length and the overall data hash value, the first overall content feature corresponding to the target data is obtained.

[0091] In actual applications, the data sender can determine the overall data length of the target data, where the overall data length indicates the amount of data contained in the target data. In some examples, the overall data length can also be called the content length of the target data, and its unit is bytes.

[0092] On the other hand, the hash value of the target data can be obtained. For the convenience of distinction, the hash value of the target data is called the overall data hash value. Specifically, there may be a situation where each data fragment is correct but the fragment combination is wrong, such as missing some data fragments or combining other irrelevant data fragments. In this regard, in this embodiment, a preset digest algorithm can also be used to obtain the overall data hash value corresponding to the target data. The overall data hash value changes accordingly with any change in the target data content, that is, as long as the target data content changes slightly, the overall data hash value also changes accordingly, so that the overall data hash value can be used to determine whether the content of the target data has changed. In some embodiments, the digest algorithm can be an MD5 information digest algorithm, which is a cryptographic hash function that can be used to generate a hash value of a preset length.

[0093] After obtaining the overall data length and the overall data hash value of the target data, the data sender may obtain the first overall content feature corresponding to the target data based on the overall data length and the overall data hash value.

[0094] It is understandable that the process of extracting the second overall content feature by the data receiver can be similar to the process of extracting the first overall content feature by the data sender. For example, if the data sender determines the first overall content feature based on the overall data length and the overall data hash value, the data receiver can obtain the overall data length and the overall data hash value corresponding to the combined multiple data fragments to obtain the second overall content feature; if the data sender determines the first overall content feature only by the overall data length or the overall data hash value, the data receiver can use the overall data length or the overall data hash value corresponding to the combined multiple data fragments as the second overall content feature.

[0095] In this embodiment, by obtaining the first overall content feature corresponding to the target data based on the overall data length and the overall data hash value, the data receiver can quickly verify whether the combined data fragments match the target data sent by the data sender, thereby effectively ensuring the accuracy of data transmission between the browser page and the local operating system.

[0096] In one embodiment, in step S203, transmitting multiple data fragments to the browser page and the data receiver in the local operating system in batches includes:

[0097] For each data shard, obtain the shard order of the data shard among multiple data shards, and associate the shard order with the data shard; transmit multiple data shards associated with the corresponding shard order to the data receiver in the browser page and the local operating system in batches, so that the data receiver can combine the multiple data shards in sequence according to the shard order associated with each data shard obtained in batches.

[0098] In actual applications, after the data receiver obtains each data slice provided by the data sender, whether it can successfully obtain the corresponding target data depends on whether the multiple data slices can be correctly combined. In some embodiments, although the data receiver can analyze each data slice one by one and identify the order of multiple data slices, this method may take up certain computing resources and time for analysis, affecting the efficiency of the target data.

[0099] In this regard, in this embodiment, the fragmentation order of each data fragment in the multiple data fragments can be obtained, and the fragmentation order is associated with the corresponding data fragment. Then, the multiple data fragments associated with the corresponding fragmentation order are transmitted to the browser page and the data receiving party in the local operating system in batches, and then after the data receiving party obtains the multiple data fragments, the multiple data fragments can be combined in sequence according to the fragmentation order of each data fragment.

[0100] In this embodiment, multiple data fragments associated with corresponding fragmentation orders are transmitted in batches to the browser page and the data recipient in the local operating system, so that the data recipient can quickly and accurately combine the multiple data fragments according to the fragmentation order, thereby effectively improving the data recipient's efficiency in combining data fragments.

[0101] In order to enable those skilled in the art to better understand the above steps, the embodiment of the present application is illustrated below by using an example, but it should be understood that the embodiment of the present application is not limited to this.

[0102] In this example, the browser page is used as the data sender and the local operating system is used as the data receiver.

[0103] When the browser page is preparing to transmit content to the host platform, it first checks whether the size of the content to be transmitted exceeds the data transmission threshold. The data transmission threshold can be defined for different services or an empirical value can be used. In this example, the data transmission threshold is 1M, which is 1048576 bytes.

[0104] If the size of the content to be transmitted exceeds the data transmission threshold, it needs to be split. The maximum data size of each data slice during the splitting process is 1M. If the size of the content to be transmitted is M bytes, it is split into N data slices, where N = rounded (M / 1048576) + 1. In this example, the data size of the content to be transmitted is 3146752 bytes, so it is split into 4 data slices.

[0105] For each data shard, the browser page generates the data block corresponding to each data shard according to the predefined data block structure. Specifically, the following fields are defined in the structure: index, content, length, md5, isEnd, where index defines the index of the data shard, that is, the sharding order of the data shard. When the content is subsequently assembled and restored, the data shards will be assembled according to the index sorting. Content defines the actual transmitted content, that is, the data shard itself. Length represents the content length of the data shard. md5 is the md5 value of the data shard, which can be used to calculate whether the transmitted data shard is correct. isEnd can be understood as the end of shard transmission, which is used to indicate whether the current data shard is the last of multiple data shards.

[0106] For the 4 fragments obtained by the above segmentation, the first fragment transmits the content of 1-1048576 bytes, the index is marked as 1, and isEnd is false; the second fragment transmits the content of 1048577-2097152, the index is marked as 2, and isEnd is false; the third fragment transmits the content of 2097153-3145728, the index is marked as 3, and isEnd is false; the fourth fragment transmits the content of 3145729-3146752, the index is marked as 4, and isEnd is true. Correspondingly, the generated 4 data blocks Segments are:

[0107] (1) Segment1: index is 1, length is 1048576, isEnd is false, content and md5 are determined based on the actual content.

[0108] (2) Segment2: index is 2, length is 1048576, isEnd is false, content and md5 are determined based on the actual content.

[0109] (3) Segment3: index is 3, length is 1048576, isEnd is false, content and md5 are determined based on the actual content.

[0110] (4) Segment4: index is 4, length is 1024, isEnd is true, content and md5 are determined based on the actual content.

[0111] On the other hand, the browser page can also generate control information for block transmission. In the specific implementation, the transmission interface sendContent (ControlInfo controlInfo) of the control information can be defined first, in which the following fields are defined: totalLength, md5, totalSegment. Among them, totalLength indicates the total data size of the content to be transmitted, in bytes, corresponding to 3146752 bytes in the above example; md5 is the md5 value corresponding to the content to be transmitted, and totalSegment is the total number of content blocks to be transmitted.

[0112] like Figure 3 As shown, after generating control information and multiple data blocks Segments, you can first call the sendContent function interface to transmit the control information, that is, first generate a ControlInfo message, call the sendContent interface to transmit it, and then call the general transmission interface, that is, the sendSegment function interface, to transmit the above-created 4 data blocks Segments to the host platform respectively. Since there are 4 data blocks that need to be transmitted, the browser page will call the sendSegment function interface 4 times, and each call will send 1 data block.

[0113] In an exemplary embodiment, Figure 4 As shown, a data receiving method is provided, and the method is applied to a data receiving party in a browser page and a local operating system as an example for explanation, including the following steps S401 to S402. Among them:

[0114] S401, receiving a browser page and a data sender in the local operating system transmitting multiple data slices to the data receiver in batches; the multiple data slices are obtained by the data sender by segmenting the target data after determining that the data size of the target data exceeds the data transmission threshold, and the data transmission threshold is determined based on the data size during normal data transmission between the browser page and the local operating system, and the data size of the data slice transmitted by the data sender each time does not exceed the data transmission threshold.

[0115] Specifically, the data sender may first determine the size of the data to be transmitted between the browser page and the local operating system. For ease of distinction, the data subsequently transmitted to the data receiver is referred to as target data.

[0116] Then, the data sender can compare the data size of the target data with the data transmission threshold. When the data size of the target data does not exceed the data transmission threshold, it can be determined that the target data can be normally transmitted between the browser page and the local operating system. When the data size of the target data exceeds the data transmission threshold, it can be determined that directly sending the target data is likely to cause an exception. In this regard, the data sender can split the target data into multiple data slices, so that the data size of each data slice obtained does not exceed the data transmission threshold.

[0117] Furthermore, after the data sender obtains multiple data fragments that do not exceed the data transmission threshold, it can send multiple data fragments to the browser page and the local operating system as the data receiver in batches.

[0118] S402, acquiring target data according to multiple data slices.

[0119] After the data receiver obtains multiple data slices, it can obtain the target data according to the multiple data slices. When the data slices are transmitted each time, the total data size of each data slice transmitted at that time does not exceed the data threshold.

[0120] In the above data receiving method, the data receiving party can receive the data from the data sender in the browser page and the local operating system and transmit multiple data slices to the data receiving party in batches, wherein the multiple data slices are obtained by the data sender by segmenting the target data after determining that the data size of the target data exceeds the data transmission threshold, and the data transmission threshold is determined based on the data size when the data is normally transmitted between the browser page and the local operating system, and the data size of the data slice transmitted by the data sender each time does not exceed the data transmission threshold; then, the data receiving party can obtain the target data based on the multiple data slices. In this embodiment, by dividing the data size of the target data to be transmitted between the browser page and the local operating system into multiple data slices, and sending the data slices to the data receiving party in the browser page and the local operating system in batches, the data size limit can be broken through, and while ensuring the normal transmission of data, the local operating system or browser page can receive larger files or content, thereby improving the transmission success rate of data of various sizes between the browser page and the local operating system of the terminal, and helping to expand the applicable scenarios of the browser page.

[0121] In one embodiment, the multiple data slices received by the data receiver are respectively associated with the first slice content features corresponding to each other; in step S402, obtaining target data according to the multiple data slices may include the following steps:

[0122] For each received data slice, extract the second slice content feature corresponding to the data slice, and determine that the data slice has passed the verification when the second slice content feature matches the first slice content feature; obtain the target data based on each data slice that has passed the verification.

[0123] In actual applications, during the transmission of data shards, the data content in the data shards may be lost or tampered with. In this embodiment, the data sender can extract features of the content of the data shards in advance to obtain the first shard content features corresponding to the data shards, and then for each data shard, the first shard content features can be associated with the data shard and sent to the data receiver.

[0124] After the data sender obtains multiple data blocks, it can transmit multiple data blocks to the data receiver in the browser page and the local operating system in batches. For each data block received, the data receiver can first verify the accuracy of the fragment content in the data block. Specifically, the data receiver can extract features of the data fragments in the data block to obtain the corresponding second fragment content features, and then compare the second fragment content features with the first fragment content features. If the second fragment content features match the first fragment content features, for example, the two are the same, it can be determined that the corresponding data fragment has passed the verification. After the data receiver verifies the data fragments in each data block and each data fragment passes the verification, the data receiver can obtain the target data based on the data fragments in each data block.

[0125] In this embodiment, by obtaining the target data based on each data segment that has passed the verification when the content feature of the second segment matches the content feature of the first segment, it can be ensured that each data segment is correct before obtaining the corresponding target data. While breaking through the transmission limit of the target data on the data size, it also effectively guarantees the accuracy and reliability of the transmission of the target data between the browser page and the local operating system.

[0126] In one embodiment, before step S402, the method may further include the following steps:

[0127] Receive a block transmission indication transmitted by a data sender to a data receiver; combine multiple data fragments obtained in batches, and determine the second overall content features corresponding to the combined multiple data fragments; when the second overall content features match the first overall content features, determine the combined multiple data fragments as target data.

[0128] The block transmission indication carries the first overall content feature corresponding to the target data.

[0129] Specifically, in this embodiment, the data sender can extract content features of the target data as a whole to obtain a first overall content feature corresponding to the target data. Then, the data sender can transmit a block transmission instruction carrying the first overall content feature to the browser page and the data receiver in the local operating system.

[0130] When the data receiver obtains the relevant multiple data fragments according to the block transmission indication, in addition to receiving the subsequent multiple associated data fragments and combining the multiple data fragments, the data receiver can also extract content features of the combined multiple data fragments to obtain the corresponding second overall content features. Although the data receiver can normally obtain multiple data fragments, different combination methods may affect the accuracy of the final combined data. In this regard, by comparing the second overall content feature with the first overall content feature, it can be determined whether the data receiver has correctly restored the target data. If the second overall content feature matches the first overall content feature, for example, the two are the same, the combined multiple data fragments can be determined as the target data fragments. If the second overall content feature does not match the first overall content feature, it can be determined that an abnormality occurred in the data fragment combination process, and the current combined multiple data fragments are not equivalent to the target data.

[0131] In this embodiment, by transmitting a block transmission indication carrying the first overall content feature to the data recipient in the browser page and the local operating system, on the one hand, the data recipient can be prompted to start receiving multiple associated data fragments, and on the other hand, the data recipient can be helped to quickly verify the accuracy of the combination of multiple data fragments, thereby improving the accuracy of data transmission between the browser page and the local operating system.

[0132] In order to enable those skilled in the art to better understand the above steps, the following examples are used to illustrate the embodiments of the present application, but it should be understood that the embodiments of the present application are not limited to this.

[0133] Continuing with the previous example, after the browser page generates 4 data blocks, during the transmission of the 4 data blocks, the host platform will receive one sendContent function call and multiple sendSegment function calls. On the one hand, through the sendContent function call, the host platform can receive control information for block transmission, which passes the total length of the transmitted content and the md5 value of the entire transmitted content. On the other hand, through multiple sendSegment function calls, the host platform receives 4 data blocks, and the verification logic must be executed for the content received by each Segment. The verification process of the data block is as follows: Figure 5As shown, the host platform calculates the content length and md5 of the data segment in the received data block respectively, and compares the calculated content length and md5 with the content length and md5 defined in the data block Segment for consistency. The subsequent process is executed only when the two are consistent.

[0134] After all four data blocks are verified, multiple data shards are first sorted according to the index in each data block Segment. The sorted order is: Segment 1 with index 1, Segment 2 with index 2, Segment 3 with index 3, and Segment 4 with index 4. Then the contents of these data shards are written into a file. The writing effect diagram is shown below. Figure 6 As shown. Finally, the length and md5 of the file are calculated, and it is determined whether the length and md5 of the file are consistent with the totalLength and md5 in the control information ControInfo. If they are consistent, it is determined that the host platform has successfully obtained the content transmitted by the browser page. The complete schematic diagram of the above process is shown as follows Figure 7 shown.

[0135] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0136] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 8As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a data transmission method or a data receiving method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.

[0137] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0138] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

[0139] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0140] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0141] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0142] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0143] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0144] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A data transmission method, characterized in that: Applied to the data sender in the browser page and the local operating system, the method includes: Determine the data size of target data to be transmitted between the browser page and the local operating system; When the data size of the target data exceeds the data transmission threshold, the data sender divides the target data into multiple data fragments; the data transmission threshold is determined based on the data size during normal data transmission between the browser page and the local operating system; The multiple data slices are transmitted in batches to the browser page and the data receiver in the local operating system, so that the data receiver obtains the target data according to the multiple data slices obtained in batches; the data size of the data slice transmitted each time does not exceed the data transmission threshold.

2. The method according to claim 1, characterized in that The transmitting the plurality of data fragments in batches to the browser page and the data receiving party in the local operating system includes: Extracting a first fragment content feature corresponding to each of the data fragments; For each of the data slices, associating the first slice content feature with the data slice to obtain a data block corresponding to the data slice; Transmitting multiple data blocks to the browser page and the data receiver in the local operating system in batches to trigger the data receiver to extract the second fragment content feature corresponding to the data fragment in the data block, and after determining that the fragment verification has passed according to each of the first fragment content features and each of the second fragment content features, obtaining the target data based on the data fragment in each of the data blocks.

3. The method according to claim 2, characterized in that The extracting the first fragment content feature corresponding to each of the data fragments includes: For each of the data slices, obtain the slice length of the data slice, and obtain the slice hash value corresponding to the data slice based on a preset digest algorithm; Based on the slice length and the slice hash value corresponding to each of the data slices, a first slice content feature corresponding to each of the data slices is obtained.

4. The method according to claim 1, characterized in that: Before transmitting the plurality of data fragments to the browser page and the data receiving party in the local operating system in batches, the method further includes: Acquire a first overall content feature corresponding to the target data; A block transmission indication carrying the first overall content feature is transmitted to the browser page and the data recipient in the local operating system; the block transmission indication is used to instruct the data recipient to combine the multiple data fragments obtained in batches, determine the second overall content feature corresponding to the combined multiple data fragments, and determine the combined multiple data fragments as the target data when the second overall content feature matches the first overall content feature.

5. The method according to claim 4, characterized in that The obtaining of the first overall content feature corresponding to the target data includes: Obtaining the overall data length of the target data, and obtaining the overall data hash value corresponding to the target data based on a preset digest algorithm; Based on the overall data length and the overall data hash value, a first overall content feature corresponding to the target data is obtained.

6. The method according to claim 4, characterized in that The transmitting the plurality of data fragments in batches to the browser page and the data receiving party in the local operating system includes: For each of the data slices, obtaining a slice order of the data slice among the multiple data slices, and associating the slice order with the data slice; The multiple data slices associated with the corresponding slice order are transmitted in batches to the browser page and the data receiving party in the local operating system, so that the data receiving party combines the multiple data slices in sequence according to the slice order associated with each data slice obtained in batches.

7. A data receiving method, characterized in that: Applied to the data receiver in the browser page and the local operating system, the method includes: The data sender in the receiving browser page and the local operating system transmits multiple data slices to the data receiver in batches; the multiple data slices are obtained by the data sender by segmenting the target data after determining that the data size of the target data exceeds a data transmission threshold, the data transmission threshold is determined based on the data size when the data is normally transmitted between the browser page and the local operating system, and the data size of the data slice transmitted by the data sender each time does not exceed the data transmission threshold; The target data is acquired according to the multiple data slices.

8. The method according to claim 7, characterized in that The received plurality of data slices are respectively associated with respective first slice content features; The acquiring the target data according to the plurality of data slices comprises: For each of the received data slices, extract a second slice content feature corresponding to the data slice, and determine that the data slice has passed verification if the second slice content feature matches the first slice content feature; The target data is obtained according to each of the data slices that have passed the verification.

9. The method according to claim 7 or 8, characterized in that: Before the step of acquiring the target data according to the plurality of data slices, the method further includes: receiving a block transmission indication transmitted by the data sending party to the data receiving party; the block transmission indication carries a first overall content feature corresponding to the target data; Combining the multiple data fragments obtained in batches, and determining the second overall content features corresponding to the combined multiple data fragments; When the second overall content feature matches the first overall content feature, the combined plurality of data fragments are determined as the target data.

10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the processor implements the steps of the data transmission method according to any one of claims 1 to 6 or the steps of the data receiving method according to any one of claims 7 to 9.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the data transmission method according to any one of claims 1 to 6 or the steps of the data receiving method according to any one of claims 7 to 9 are implemented.

12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the data transmission method according to any one of claims 1 to 6 or the steps of the data receiving method according to any one of claims 7 to 9 are implemented.