CN111770187B - Resource downloading method and device - Google Patents

Resource downloading method and device Download PDF

Info

Publication number
CN111770187B
CN111770187B CN202010632199.5A CN202010632199A CN111770187B CN 111770187 B CN111770187 B CN 111770187B CN 202010632199 A CN202010632199 A CN 202010632199A CN 111770187 B CN111770187 B CN 111770187B
Authority
CN
China
Prior art keywords
downloaded
resource
downloading
target
connection
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.)
Active
Application number
CN202010632199.5A
Other languages
Chinese (zh)
Other versions
CN111770187A (en
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.)
Zhuhai Xishanju Digital Technology Co ltd
Original Assignee
Zhuhai Xishanju Digital Technology 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 Zhuhai Xishanju Digital Technology Co ltd filed Critical Zhuhai Xishanju Digital Technology Co ltd
Priority to CN202010632199.5A priority Critical patent/CN111770187B/en
Publication of CN111770187A publication Critical patent/CN111770187A/en
Application granted granted Critical
Publication of CN111770187B publication Critical patent/CN111770187B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The application provides a resource downloading method and device, wherein the method comprises the following steps: determining a target file to be downloaded, establishing a first connection with a server and establishing a second connection with other clients according to the target file to be downloaded, wherein the target file to be downloaded comprises a plurality of resource packages to be downloaded which are ordered according to a resource sequence; judging whether a target resource package to be downloaded in the plurality of resource packages to be downloaded is a scarce resource or not; if yes, downloading the target resource package to be downloaded in a first downloading mode through a first connection; if not, downloading the target resource package to be downloaded in a second downloading mode through a second connection.

Description

Resource downloading method and device
Technical Field
The present disclosure relates to the field of internet technologies, and in particular, to a method and apparatus for downloading resources, a computing device, and a computer readable storage medium.
Background
The conventional resource downloading method in the prior art generally comprises HTTP downloading and BT downloading, wherein the downloading mode of HTTP downloading is downloading sequentially according to a file sequence, along with the development of the game field, pre-update downloading can be preset before the game needs to be updated greatly, a client firstly inquires whether a pre-update resource package exists on a server and downloads, for most players, normal games can be performed after the pre-update resource package is downloaded, and then other resource packages except the pre-update package are downloaded. However, the HTTP download method still requires downloading resources from the central server, so there is a bandwidth limitation, and there is a limitation on the number of clients downloaded at the same time, resulting in a slow download speed.
Another downloading method in the prior art is BT downloading, and the clients download and upload resources at the same time, and the clients mutually upload resources. Early downloads required a central server for coordinating the download relationships of the individual users. The present development to the BT2.0 stage is a distributed hash algorithm, and the resource of the client can be found to realize downloading without a central server. However, BT download has a major drawback that the distribution of resources is very uneven, and for resources with more sources, the download speed is fast, but for scarce resources, the download speed is slow due to fewer uploadable clients, which severely limits the efficiency and speed of BT download.
Disclosure of Invention
In view of the foregoing, embodiments of the present application provide a method and apparatus for downloading resources, a computing device, and a computer readable storage medium, so as to solve the technical drawbacks in the prior art.
According to a first aspect of embodiments of the present disclosure, there is provided a resource downloading method, including:
determining a target file to be downloaded, establishing a first connection with a server and establishing a second connection with other clients according to the target file to be downloaded, wherein the target file to be downloaded comprises a plurality of resource packages to be downloaded which are ordered according to a resource sequence;
judging whether a target resource package to be downloaded in the plurality of resource packages to be downloaded is a scarce resource or not;
if yes, downloading the target resource package to be downloaded in a first downloading mode through a first connection;
if not, downloading the target resource package to be downloaded in a second downloading mode through a second connection.
According to a second aspect of embodiments of the present specification, there is provided a resource downloading apparatus, comprising:
the system comprises a download establishing module, a download processing module and a download processing module, wherein the download establishing module is configured to determine a target file to be downloaded, establish a first connection with a server according to the target file to be downloaded and establish a second connection with other clients, and the target file to be downloaded comprises a plurality of resource packages to be downloaded which are ordered according to a resource sequence;
the resource judging module is configured to judge whether a target resource package to be downloaded in the plurality of resource packages to be downloaded is a scarce resource or not; if yes, executing a first downloading module; if not, executing a second downloading module;
the first downloading module is configured to download the target resource package to be downloaded in a first downloading mode through a first connection;
and the second downloading module is configured to download the target resource package to be downloaded in a second downloading mode through a second connection.
According to a third aspect of embodiments of the present specification, there is provided a computing device comprising a memory, a processor and computer instructions stored on the memory and executable on the processor, the processor implementing the steps of the resource downloading method when executing the instructions.
According to a fourth aspect of embodiments of the present description, there is provided a computer readable storage medium storing computer instructions which, when executed by a processor, implement the steps of the resource downloading method.
In the downloading process of the file to be downloaded, the HTTP downloading and the BT downloading are simultaneously used for downloading, and an allocation mechanism of division downloading is established between the HTTP downloading and the BT downloading for the scarce resources, and the BT downloading for the non-scarce resources.
Drawings
FIG. 1 is a block diagram of a computing device provided by an embodiment of the present application;
FIG. 2 is a flowchart of a method for downloading resources provided in an embodiment of the present application;
FIG. 3 is another flowchart of a resource downloading method provided by an embodiment of the present application;
FIG. 4 is another flow chart of a resource downloading method provided by an embodiment of the present application;
FIG. 5 is a schematic diagram of a resource downloading method according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a resource downloading device according to an embodiment of the present application.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. This application is, however, susceptible of embodiment in many other ways than those herein described and similar generalizations can be made by those skilled in the art without departing from the spirit of the application and the application is therefore not limited to the specific embodiments disclosed below.
The terminology used in the one or more embodiments of the specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of the specification. As used in this specification, one or more embodiments and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used in one or more embodiments of the present specification refers to and encompasses any or all possible combinations of one or more of the associated listed items.
It should be understood that, although the terms first, second, etc. may be used in one or more embodiments of this specification to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first may also be referred to as a second, and similarly, a second may also be referred to as a first, without departing from the scope of one or more embodiments of the present description. The word "if" as used herein may be interpreted as "at … …" or "at … …" or "responsive to a determination", depending on the context.
First, terms related to one or more embodiments of the present invention will be explained.
Target file to be downloaded: and the client downloads all resources corresponding to the file in the current downloading task.
Resource sequence: and the sorting queue of the plurality of resource packages to be downloaded forming the target file to be downloaded.
And (5) waiting for downloading the resource package: dividing a target file to be downloaded into a plurality of resource packages according to the seed file;
the target waits for the resource package to be downloaded: refers to a resource package that the client is about to download.
Scarce resources: in BT download, there are fewer resource packages with fewer resource distributions and more requested downloads.
Scarcity degree: and under the P2P file transmission protocol, each client calculates the scarcity of each resource to be downloaded according to the request number and the resource distribution condition of each resource package to be downloaded in the current period.
Threshold of scarcity: and the client side carries out repeated feedback adjustment according to the experience data to obtain a threshold value for judging the resource scarcity.
Hypertext transfer protocol HTTP download: file transfer between client-server based on TCP/IP protocol.
Bit stream BT download: based on the downloading mode of the bit stream BitTorrent protocol, the bit stream BitTorrent protocol is a P2P file transfer protocol which is constructed on top of the TCP/IP protocol and is in an application layer of the TCP/IP structure, and the BitTorrent protocol itself also comprises a plurality of specific content protocols and expansion protocols and is in continuous expansion. According to the BitTorrent protocol, a file issued by a file issuer generates a seed file for providing a file, wherein the seed file is essentially a text file and comprises two parts of trace (Tracker) information and file information, the trace information is mainly an address of a trace server required to be used in BT downloading and a setting for the trace server, the file information is generated according to calculation of a target file, and a calculation result is encoded according to a B encoding rule in the BitTorrent protocol, the main principle is that the file for providing downloading is virtually divided into blocks with the same size, the block size is an integer multiple of 2k (because the blocks are virtual blocks, each block file is not generated on a hard disk), and index information and a Hash verification code of each block are written into the seed file, so that the seed file is an index of the downloaded file. The downloading of file content by the downloading person needs to obtain the corresponding seed file and then uses the BT client software for downloading. During downloading, the BT client firstly analyzes the seed file to obtain a tracking address, and then connects with the tracking server. The tracking server responds to the request of the downloadable and provides the IP address of other downloadable (including the publisher) to the downloadable. The downloadable connects with other downloadable, according to the seed file, the two informs the opposite party of the own resource package, and then exchanges the data.
In the present application, a method and apparatus for downloading resources, a computing device, and a computer-readable storage medium are provided, and the following embodiments are described in detail.
Fig. 1 shows a block diagram of a computing device 100 according to an embodiment of the present description. The components of the computing device 100 include, but are not limited to, a memory 110 and a processor 120. Processor 120 is coupled to memory 110 via bus 130 and database 150 is used to store data.
Computing device 100 also includes access device 140, access device 140 enabling computing device 100 to communicate via one or more networks 160. Examples of such networks include the Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the internet. The access device 140 may include one or more of any type of network interface, wired or wireless (e.g., a Network Interface Card (NIC)), such as an IEEE802.11 Wireless Local Area Network (WLAN) wireless interface, a worldwide interoperability for microwave access (Wi-MAX) interface, an ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a bluetooth interface, a Near Field Communication (NFC) interface, and so forth.
In one embodiment of the present description, the above-described components of computing device 100, as well as other components not shown in FIG. 1, may also be connected to each other, such as by a bus. It should be understood that the block diagram of the computing device shown in FIG. 1 is for exemplary purposes only and is not intended to limit the scope of the present description. Those skilled in the art may add or replace other components as desired.
Computing device 100 may be any type of stationary or mobile computing device including a mobile computer or mobile computing device (e.g., tablet, personal digital assistant, laptop, notebook, netbook, etc.), mobile phone (e.g., smart phone), wearable computing device (e.g., smart watch, smart glasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or PC. Computing device 100 may also be a mobile or stationary server.
Wherein the processor 120 may perform the steps of the method shown in fig. 2. Fig. 2 is a schematic flow chart illustrating a method of resource download according to an embodiment of the present application, including steps 202 through 208.
Step 202: and determining a target file to be downloaded, establishing a first connection with the server according to the target file to be downloaded and establishing a second connection with other clients, wherein the target file to be downloaded comprises a plurality of resource packages to be downloaded which are ordered according to a resource sequence.
In an embodiment of the present application, as shown in fig. 3, a first connection is established between a file to be downloaded and a server according to the target and a second connection is established between the file to be downloaded and other clients, including steps 302 to 304.
Step 302: and sending a downloading request corresponding to the target file to be downloaded to the server, and establishing a first connection with the server.
In the embodiment of the application, a client determines a target file to be downloaded according to a user instruction, and sends a downloading request to a server storing the target file to be downloaded, so that HTTP downloading is established with the server based on a hypertext transfer protocol.
Step 304: and acquiring a seed file corresponding to the target file to be downloaded, and establishing a second connection with other clients according to the seed file corresponding to the target file to be downloaded.
In the embodiment of the application, a client determines a target file to be downloaded according to a user instruction, acquires a seed file corresponding to the target file to be downloaded, and establishes BT download with other clients through a P2P file transfer protocol according to the seed file corresponding to the target file to be downloaded.
Step 204: and judging whether the target resource package to be downloaded in the plurality of resource packages to be downloaded is a scarce resource or not. If yes, go to step 206, if no, go to step 208.
In an embodiment of the present application, as shown in fig. 4, determining whether a target resource packet to be downloaded in the plurality of resource packets to be downloaded is a scarce resource includes steps 402 to 406:
step 402: calculating the scarcity degree corresponding to each resource packet to be downloaded according to a preset period, and judging whether the scarcity degree corresponding to each resource packet is larger than a scarcity degree threshold value in the current period; if yes, go to step 404; if not, go to step 406.
In an embodiment of the present application, calculating, according to a preset period, a scarcity corresponding to each resource packet to be downloaded includes:
acquiring the corresponding current resource request number and resource possession number of each resource package to be downloaded in the target file to be downloaded in the current period according to the preset period;
and carrying out weighted summation on the current resource request number and the resource possession number to obtain the corresponding scarcity of each resource package to be downloaded in the current period, and refreshing according to a preset period.
Step 404: marking the resource package to be downloaded as a scarce resource;
step 406: the resource package to be downloaded is marked as a non-scarce resource.
In the above embodiment, a flag bit is stored for the resource packet to be downloaded that is not yet downloaded, that is, the corresponding scarcity degree in the current period of the resource packet to be downloaded, where the scarcity degree is dynamically changed according to the comprehensive factors such as the current resource request number, the resource possession number, the HTTP download distance, etc., and certainly, the problem of scarcity degree is not required to be considered for the resource packet that has already been downloaded.
According to the method and the device, the corresponding scarcity degree of the resource package to be downloaded is dynamically calculated, the scarcity degree threshold value (empirical value is set according to the requirement, repeated feedback adjustment is carried out according to empirical data) in the current period, the calculated scarcity degree is compared with the threshold value, whether the resource package to be downloaded is a scarcity resource is determined, the resource is reasonably divided, and the downloading speed and the selecting efficiency of the downloading mode are improved to the greatest extent.
Step 206: and downloading the target resource package to be downloaded in a first downloading mode through a first connection.
Step 208: and downloading the target resource package to be downloaded in a second downloading mode through a second connection.
In the embodiment of the present application, if it is determined that the target resource package to be downloaded is a scarce resource, HTTP is used for downloading the target resource package to be downloaded, and if it is determined that the target resource package to be downloaded is a non-scarce resource, BT is used for downloading the target resource package to be downloaded.
In the downloading process of the file to be downloaded, the HTTP downloading and the BT downloading are simultaneously used for downloading, and an allocation mechanism of division downloading is established between the HTTP downloading and the BT downloading for the scarce resources, and the BT downloading for the non-scarce resources.
In an embodiment of the present application, after downloading the target resource package to be downloaded in a first downloading manner through a first connection, the method further includes:
and notifying other clients of the target to-be-downloaded resource package through the second connection, so that clients which do not download the target to-be-downloaded resource package in other clients can download the target to-be-downloaded resource package in a second downloading mode preferentially through the second connection.
In the above embodiment, after the BT download is started, each user establishes a connection with other users who download the same target download file, in the downloading process, each user sends a request to other users to obtain a specific resource package, and, at the same time, when any client finishes downloading the specific resource package in the HTTP download manner, the client also informs other clients based on the connection relationship established by the users, so that the client in other clients, which does not download the specific resource package, downloads the specific resource package preferentially in the BT download manner.
In an embodiment of the present application, the method further comprises:
and under the condition that the target resource package to be downloaded is downloaded in a second downloading mode through a second connection, if the target resource package to be downloaded cannot be obtained, the target resource package to be downloaded is downloaded in a first downloading mode through a first connection, and a notice of completion of downloading the target resource package to be downloaded is sent to other clients.
In the above embodiment, in the initial downloading stage, no scarce resources are defaulted between the clients, BT downloading is defaulted between the clients, in the subsequent downloading process, if the client cannot find resources through BT downloading or the target resource package to be downloaded is scarce resources, the target resource package to be downloaded is downloaded by using HTTP downloading, and after the downloading is completed, other clients are notified, so that the client in other clients, which does not download the specific resource package, downloads the specific resource package preferentially by BT downloading.
In the embodiment of the present application, the first connection is a connection established through a transmission control protocol TCP/internet protocol IP protocol, and the first downloading mode is a hypertext transfer protocol HTTP downloading mode;
the second connection is a connection established through a P2P file transfer protocol, and the second downloading mode is bit stream BT downloading.
Fig. 5 illustrates a resource downloading method according to an embodiment of the present disclosure, which takes a target file to be downloaded a as an example, where the target file to be downloaded includes a resource packet to be downloaded a to a resource packet to be downloaded g, which are ordered according to a resource sequence, and includes steps 502 to 520.
Step 502: sending a downloading request corresponding to the target file A to be downloaded to the server, and establishing connection with the server based on a Transmission Control Protocol (TCP)/Internet Protocol (IP);
step 504: acquiring a seed file corresponding to the target file to be downloaded, and establishing connection with other clients through a P2P file transfer protocol according to the seed file corresponding to the target file to be downloaded A;
step 506: and in the initial downloading stage, HTTP downloading is sequentially carried out on the resource packets to be downloaded, which are positioned at the starting position and the middle position of the resource sequence, and BT downloading is reversely carried out on the resource packets to be downloaded, which are positioned at the tail position and the middle position of the resource sequence.
Step 508: in the downloading process, under the condition that the target to-be-downloaded resource package f is required to be downloaded, calculating the scarcity degree corresponding to the target to-be-downloaded resource package f in the current period according to the current resource request number and the resource possession number corresponding to the target to-be-downloaded resource package f in the current period.
Step 510: and comparing the corresponding scarcity of the target resource package f to be downloaded in the current period with a scarcity threshold value in the current period, and marking the target resource package f to be downloaded as a scarcity resource or a non-scarcity resource.
Step 512: and under the condition that the target resource package f to be downloaded is a scarce resource, downloading the target resource package f to be downloaded through HTTP.
Step 514: after downloading the target to-be-downloaded resource package f through HTTP downloading, notifying other clients of the target to-be-downloaded resource package f through a P2P file transmission protocol, so that clients which do not download the target to-be-downloaded resource package in the other clients download the target to-be-downloaded resource package f preferentially through BT downloading.
Step 516: and downloading the target resource package to be downloaded f in a BT downloading mode under the condition that the target resource package to be downloaded f is a non-scarce resource.
Step 518: and in the downloading process of the target resource package f to be downloaded, receiving a notice of the completion of downloading the resource package c to be downloaded sent by other clients, wherein the resource package c to be downloaded is a scarce resource, and preferably downloading the resource package c to be downloaded by BT after the completion of downloading the target resource package f to be downloaded.
Step 520: if the target to-be-downloaded resource package f cannot be downloaded in the BT downloading mode, a downloading request corresponding to the target to-be-downloaded resource package f is sent to the server, and the target to-be-downloaded resource package f is downloaded in the HTTP downloading mode.
According to the method and the device, the BT download and the HTTP download are used for selectively using the resource packages respectively, the whole download process is fully considered, and the download process is refined and ordered, so that the download speed is improved to the greatest extent by alternately utilizing two different download modes, and the resources are saved.
Corresponding to the above method embodiments, the present disclosure further provides an embodiment of a resource downloading device, and fig. 6 shows a schematic structural diagram of the resource downloading device according to one embodiment of the present disclosure. As shown in fig. 6, the apparatus includes:
the download establishing module 601 is configured to determine a target file to be downloaded, and establish a first connection with the server and establish a second connection with other clients according to the target file to be downloaded, wherein the target file to be downloaded includes a plurality of resource packages to be downloaded ordered according to a resource sequence;
a resource determining module 602 configured to determine whether a target resource package to be downloaded of the plurality of resource packages to be downloaded is a scarce resource; if yes, executing a first downloading module; if not, executing a second downloading module;
a first downloading module 603 configured to download the target resource package to be downloaded in a first downloading manner through a first connection;
a second downloading module 604, configured to download the target resource package to be downloaded in a second downloading manner through a second connection.
Optionally, the apparatus further includes:
and the resource sharing module is configured to inform other clients of the target to-be-downloaded resource package through a second connection, so that clients which do not download the target to-be-downloaded resource package in other clients download the target to-be-downloaded resource package in a second downloading mode preferentially through the second connection.
Optionally, the download establishing module 601 includes:
the first connection establishing unit is configured to send a downloading request corresponding to the target file to be downloaded to the server and establish a first connection with the server;
the second connection establishing unit is configured to acquire a seed file corresponding to the file to be downloaded, and establish second connection with other clients according to the seed file corresponding to the file to be downloaded.
Optionally, the resource determining module 602 includes:
the scarcity judging unit is configured to calculate the scarcity corresponding to each resource packet to be downloaded according to a preset period and judge whether the scarcity corresponding to each resource packet is larger than a scarcity threshold value in the current period; if yes, executing a first marking unit; if not, executing a second marking unit;
a first marking unit configured to mark a resource package to be downloaded as a scarce resource;
and a second marking unit configured to mark the resource package to be downloaded as a non-scarce resource.
Optionally, the scarcity judging unit includes:
the data monitoring subunit is configured to acquire the corresponding current resource request number and resource possession number of each resource package to be downloaded in the target file to be downloaded in the current period according to the preset period;
and the rarity calculating subunit is configured to carry out weighted summation on the current resource request number and the resource possession number to obtain the rarity corresponding to each resource packet to be downloaded in the current period and refresh the resource packet according to a preset period.
Optionally, the apparatus further includes:
and the standby downloading module is configured to download the target resource package to be downloaded in a first downloading mode through the first connection and send a notice of completion of downloading the target resource package to other clients if the target resource package to be downloaded cannot be obtained under the condition that the target resource package to be downloaded is downloaded in a second downloading mode through the second connection.
Optionally, the first connection is a connection established through a transmission control protocol TCP/internet protocol IP protocol, and the first downloading mode is a hypertext transfer protocol HTTP downloading mode;
the second connection is a connection established through a P2P file transfer protocol, and the second downloading mode is bit stream BT downloading.
In the downloading process of the file to be downloaded, the HTTP downloading and the BT downloading are simultaneously used for downloading, and an allocation mechanism of division downloading is established between the HTTP downloading and the BT downloading for the scarce resources, and the BT downloading for the non-scarce resources.
An embodiment of the present application also provides a computing device including a memory, a processor, and computer instructions stored on the memory and executable on the processor, the processor implementing the following steps when executing the instructions:
determining a target file to be downloaded, establishing a first connection with a server and establishing a second connection with other clients according to the target file to be downloaded, wherein the target file to be downloaded comprises a plurality of resource packages to be downloaded which are ordered according to a resource sequence;
judging whether a target resource package to be downloaded in the plurality of resource packages to be downloaded is a scarce resource or not;
if yes, downloading the target resource package to be downloaded in a first downloading mode through a first connection;
if not, downloading the target resource package to be downloaded in a second downloading mode through a second connection.
An embodiment of the present application also provides a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the steps of the resource downloading method as described above.
The above is an exemplary version of a computer-readable storage medium of the present embodiment. It should be noted that, the technical solution of the computer readable storage medium and the technical solution of the resource downloading method belong to the same concept, and details of the technical solution of the computer readable storage medium which are not described in detail can be referred to the description of the technical solution of the resource downloading method.
The foregoing describes specific embodiments of the present disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
The computer instructions include computer program code that may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. It should be noted that the computer readable medium contains content that can be appropriately scaled according to the requirements of jurisdictions in which such content is subject to legislation and patent practice, such as in certain jurisdictions in which such content is subject to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.
It should be noted that, for the sake of simplicity of description, the foregoing method embodiments are all expressed as a series of combinations of actions, but it should be understood by those skilled in the art that the present application is not limited by the order of actions described, as some steps may be performed in other order or simultaneously in accordance with the present application. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily all necessary for the present application.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to the related descriptions of other embodiments.
The above-disclosed preferred embodiments of the present application are provided only as an aid to the elucidation of the present application. Alternative embodiments are not intended to be exhaustive or to limit the invention to the precise form disclosed. Obviously, many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the application and the practical application, to thereby enable others skilled in the art to best understand and utilize the application. This application is to be limited only by the claims and the full scope and equivalents thereof.

Claims (10)

1. A method for downloading resources, the method being applied to a client, the method comprising:
determining a target file to be downloaded, establishing a first connection with a server according to the target file to be downloaded and establishing a second connection with other clients, wherein the target file to be downloaded comprises a plurality of resource packages to be downloaded which are ordered according to a resource sequence, the resource packages to be downloaded which are positioned at the starting position and the middle position of the resource sequence are sequentially downloaded in a first downloading mode in an initial downloading stage, and the resource packages to be downloaded which are positioned at the tail position and the middle position of the resource sequence are downloaded in a second downloading mode in a reverse direction, wherein the first connection is a connection established through a Transmission Control Protocol (TCP)/Internet Protocol (IP), the first downloading mode is hypertext transfer protocol (HTTP) downloading, the second connection is a connection established through a P2P file transfer protocol, and the second downloading mode is bit stream (BT) downloading;
according to the current resource request number and the resource possession number corresponding to the target to-be-downloaded resource package in the current period, calculating the corresponding scarcity of the target to-be-downloaded resource package in the current period, and judging whether the target to-be-downloaded resource package in the plurality of to-be-downloaded resource packages is a scarcity resource or not;
if yes, downloading the target resource package to be downloaded in a first downloading mode through a first connection;
notifying other clients of the target to-be-downloaded resource package through a second connection, so that clients which do not download the target to-be-downloaded resource package in other clients download the target to-be-downloaded resource package in a second downloading mode preferentially through the second connection;
under the condition that the target resource package to be downloaded is downloaded in a second downloading mode through a second connection, if the target resource package to be downloaded cannot be obtained, the target resource package to be downloaded is downloaded in a first downloading mode through a first connection, and a notice of completion of downloading the target resource package to be downloaded is sent to other clients;
if not, downloading the target resource package to be downloaded in a second downloading mode through a second connection.
2. The method of claim 1, wherein establishing a first connection with a server and a second connection with other clients according to the target file to be downloaded comprises:
sending a downloading request corresponding to the target file to be downloaded to the server, and establishing a first connection with the server;
and acquiring a seed file corresponding to the target file to be downloaded, and establishing a second connection with other clients according to the seed file corresponding to the target file to be downloaded.
3. The method of claim 1, wherein determining whether a target resource package to be downloaded of the plurality of resource packages to be downloaded is a scarce resource comprises:
calculating the scarcity degree corresponding to each resource packet to be downloaded according to a preset period, and judging whether the scarcity degree corresponding to each resource packet is larger than a scarcity degree threshold value in the current period;
if yes, marking the resource package to be downloaded as a scarce resource;
if not, the resource package to be downloaded is marked as non-scarce resource.
4. A method according to claim 3, wherein calculating the scarcity degree corresponding to each resource package to be downloaded according to the preset period comprises:
acquiring the corresponding current resource request number and resource possession number of each resource package to be downloaded in the target file to be downloaded in the current period according to the preset period;
and carrying out weighted summation on the current resource request number and the resource possession number to obtain the corresponding scarcity of each resource package to be downloaded in the current period, and refreshing according to a preset period.
5. A resource downloading apparatus, configured to a client, the apparatus comprising:
the downloading establishing module is configured to determine a target file to be downloaded, establish a first connection with the server according to the target file to be downloaded and establish a second connection with other clients, wherein the target file to be downloaded comprises a plurality of resource packages to be downloaded ordered according to a resource sequence, the resource packages to be downloaded positioned at the starting position and the middle position of the resource sequence are sequentially downloaded in a first downloading mode in an initial downloading stage, the resource packages to be downloaded positioned at the tail position and the middle position of the resource sequence are downloaded in a second downloading mode in a reverse direction, the first connection is a connection established through a Transmission Control Protocol (TCP)/Internet Protocol (IP) protocol, the first downloading mode is hypertext transfer protocol (HTTP) downloading, the second connection is a connection established through a P2P file transfer protocol, and the second downloading mode is bit stream (BT) downloading;
the resource judging module is configured to calculate the corresponding scarcity of the target resource package to be downloaded in the current period according to the corresponding current resource request number and the corresponding resource possession number of the target resource package to be downloaded in the current period, and judge whether the target resource package to be downloaded in the plurality of resource packages to be downloaded is a scarcity resource; if yes, executing a first downloading module; if not, executing a second downloading module;
the first downloading module is configured to download the target resource package to be downloaded in a first downloading mode through a first connection;
the resource sharing module is configured to notify other clients of the target to-be-downloaded resource package through a second connection, so that clients which do not download the target to-be-downloaded resource package in the other clients download the target to-be-downloaded resource package in a second downloading mode preferentially through the second connection;
the standby downloading module is configured to, under the condition that the target resource package to be downloaded is downloaded in a second downloading mode through a second connection, if the target resource package to be downloaded cannot be obtained, download the target resource package to be downloaded in a first downloading mode through a first connection, and send a notification of completion of downloading the target resource package to be downloaded to other clients;
and the second downloading module is configured to download the target resource package to be downloaded in a second downloading mode through a second connection.
6. The apparatus of claim 5, wherein the download establishing module comprises:
the first connection establishing unit is configured to send a downloading request corresponding to the target file to be downloaded to the server and establish a first connection with the server;
the second connection establishing unit is configured to acquire a seed file corresponding to the file to be downloaded, and establish second connection with other clients according to the seed file corresponding to the file to be downloaded.
7. The apparatus of claim 5, wherein the resource determination module comprises:
the scarcity judging unit is configured to calculate the scarcity corresponding to each resource packet to be downloaded according to a preset period and judge whether the scarcity corresponding to each resource packet is larger than a scarcity threshold value in the current period; if yes, executing a first marking unit; if not, executing a second marking unit;
a first marking unit configured to mark a resource package to be downloaded as a scarce resource;
and a second marking unit configured to mark the resource package to be downloaded as a non-scarce resource.
8. The apparatus according to claim 7, wherein the scarcity judging unit includes:
the data monitoring subunit is configured to acquire the corresponding current resource request number and resource possession number of each resource package to be downloaded in the target file to be downloaded in the current period according to the preset period;
and the rarity calculating subunit is configured to carry out weighted summation on the current resource request number and the resource possession number to obtain the rarity corresponding to each resource packet to be downloaded in the current period and refresh the resource packet according to a preset period.
9. A computing device comprising a memory, a processor, and computer instructions stored on the memory and executable on the processor, wherein the processor, when executing the instructions, implements the steps of the method of any of claims 1-4.
10. A computer readable storage medium storing computer instructions which, when executed by a processor, implement the steps of the method of any one of claims 1-4.
CN202010632199.5A 2020-07-03 2020-07-03 Resource downloading method and device Active CN111770187B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010632199.5A CN111770187B (en) 2020-07-03 2020-07-03 Resource downloading method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010632199.5A CN111770187B (en) 2020-07-03 2020-07-03 Resource downloading method and device

Publications (2)

Publication Number Publication Date
CN111770187A CN111770187A (en) 2020-10-13
CN111770187B true CN111770187B (en) 2023-06-13

Family

ID=72723666

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010632199.5A Active CN111770187B (en) 2020-07-03 2020-07-03 Resource downloading method and device

Country Status (1)

Country Link
CN (1) CN111770187B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101635737A (en) * 2008-07-25 2010-01-27 阿里巴巴集团控股有限公司 Downloading method, system, P2P server and client
CN101841556A (en) * 2010-02-23 2010-09-22 中国科学院计算技术研究所 Method and system for placing resources replication in CDN-P2P (Content Distribution Network-Peer-to-Peer) network
CN102377821A (en) * 2011-10-17 2012-03-14 邦讯技术股份有限公司 Intelligent version updating method and device for network terminal equipment
CN106888239A (en) * 2015-12-16 2017-06-23 天脉聚源(北京)科技有限公司 A kind of file user-defined method for down loading of P2P and system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103248645B (en) * 2012-02-08 2018-03-16 深圳市腾讯计算机系统有限公司 BT off-line datas download system and method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101635737A (en) * 2008-07-25 2010-01-27 阿里巴巴集团控股有限公司 Downloading method, system, P2P server and client
CN101841556A (en) * 2010-02-23 2010-09-22 中国科学院计算技术研究所 Method and system for placing resources replication in CDN-P2P (Content Distribution Network-Peer-to-Peer) network
CN102377821A (en) * 2011-10-17 2012-03-14 邦讯技术股份有限公司 Intelligent version updating method and device for network terminal equipment
CN106888239A (en) * 2015-12-16 2017-06-23 天脉聚源(北京)科技有限公司 A kind of file user-defined method for down loading of P2P and system

Also Published As

Publication number Publication date
CN111770187A (en) 2020-10-13

Similar Documents

Publication Publication Date Title
CN112181666B (en) Equipment assessment and federal learning importance aggregation method based on edge intelligence
CN110262845B (en) Block chain enabled distributed computing task unloading method and system
CN109981751B (en) File transmission method and system, computer equipment and storage medium
CN107911722B (en) Content distribution network scheduling method and device, electronic equipment and computer readable storage medium
CN109756581B (en) File transmission system and method, computing device and storage medium
CN111768231B (en) Product information recommendation method and device
Conway-Jones et al. Demonstration of federated learning in a resource-constrained networked environment
WO2019019649A1 (en) Method and apparatus for generating investment portfolio product, storage medium and computer device
CN112311897A (en) Resource file downloading method, device, equipment and medium
CN110619388B (en) Gradient synchronization method and device in distributed training
CN112968959B (en) Resource request method and terminal
CN114650277B (en) File transmission control method and device
CN103905516B (en) The method and respective server and terminal of sharing data
WO2022033241A1 (en) Object processing method and apparatus, storage medium, and electronic device
US20230362278A1 (en) Systems and methods for multi-client content delivery
CN108540400A (en) A kind of data transfer control method, control device, terminal and readable storage medium storing program for executing
CN109962947A (en) Method for allocating tasks and device in a kind of peer-to-peer network
CN114222168A (en) Resource scheduling method and system
CN110795235B (en) Method and system for deep learning and cooperation of mobile web
CN111770186A (en) Multi-content distribution network load balancing method and device
CN111770187B (en) Resource downloading method and device
CN110191362B (en) Data transmission method and device, storage medium and electronic equipment
CN105847396A (en) Data transmission method and device
CN112637351B (en) File downloading method and device
CN110995796A (en) Data transmission method and device based on private line

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 519000 room 402, Room 401, No. 327, Qiandao Ring Road, Tangjiawan Town, high tech Zone, Zhuhai City, Guangdong Province

Applicant after: Zhuhai Xishanju Digital Technology Co.,Ltd.

Address before: 519000 room 402, Room 401, No. 327, Qiandao Ring Road, Tangjiawan Town, high tech Zone, Zhuhai City, Guangdong Province

Applicant before: ZHUHAI SEASUN MOBILE GAME TECHNOLOGY Co.,Ltd.

GR01 Patent grant
GR01 Patent grant