CN109413190B - File acquisition method and device, electronic equipment and storage medium - Google Patents

File acquisition method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN109413190B
CN109413190B CN201811309346.4A CN201811309346A CN109413190B CN 109413190 B CN109413190 B CN 109413190B CN 201811309346 A CN201811309346 A CN 201811309346A CN 109413190 B CN109413190 B CN 109413190B
Authority
CN
China
Prior art keywords
file
terminal
target
server
acquisition request
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
CN201811309346.4A
Other languages
Chinese (zh)
Other versions
CN109413190A (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201811309346.4A priority Critical patent/CN109413190B/en
Publication of CN109413190A publication Critical patent/CN109413190A/en
Application granted granted Critical
Publication of CN109413190B publication Critical patent/CN109413190B/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/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • 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]

Abstract

The invention discloses a file acquisition method, a file acquisition device, electronic equipment and a storage medium, and belongs to the technical field of networks. The method comprises the following steps: when an acquisition instruction is received, acquiring the number of target terminals, wherein the number of the target terminals refers to the total number of the first terminal and the at least one second terminal; sending a first acquisition request to a server based on the number of the target terminals and the file identification, wherein the first acquisition request is used for indicating the server to segment the target file based on the number of the target terminals and obtain a plurality of file segments; receiving a first file fragment in a plurality of file fragments sent by the server; acquiring a second file fragment from the at least one second terminal, wherein the second file fragment is sent to the at least one second terminal by the server; and generating the target file based on the first file fragment and a second file fragment acquired from the at least one second terminal. The file is segmented by the server, and the plurality of terminals share the file segments, so that the file acquisition efficiency is improved.

Description

File acquisition method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of network technologies, and in particular, to a file obtaining method and apparatus, an electronic device, and a storage medium.
Background
With the development of network technology, users can acquire required files from a network, such as installation packages of application programs, video files and the like. In general, a user may download a file in a special downloading application, and a background server of the downloading application provides the file to be downloaded for the user's terminal.
In the related art, taking the acquisition of the installation package of the application as an example, the process of acquiring the file is as follows: when a user needs to acquire an installation package of a certain application program, the terminal sends an acquisition request to the server according to the program identifier of the target application program selected by the user. And the server acquires the installation package of the target application program according to the program identifier, and sends the installation package to the terminal, and the terminal acquires the installation package.
However, when the number of download requests received by the server in a certain period is large, for example, at the beginning of the release of a certain game application, the server needs to send installation packages to a large number of terminals at the same time, even if the current network transmission rate of the server is high, the actual download speed of each terminal is still low, and a user still needs to wait for a long acquisition time, so that the file acquisition efficiency is low.
Disclosure of Invention
The embodiment of the invention provides a file acquisition method, a file acquisition device, electronic equipment and a storage medium, and can solve the problem of low file acquisition efficiency. The technical scheme is as follows:
in one aspect, a file acquisition method is provided, where the method is applied to a first terminal, and the first terminal establishes a peer-to-peer communication connection with at least one second terminal, and the method includes:
when an acquisition instruction is received, acquiring the number of target terminals, wherein the number of the target terminals refers to the total number of the first terminal and the at least one second terminal;
sending a first acquisition request to a server based on the number of the target terminals and the file identification, wherein the first acquisition request is used for indicating the server to segment a target file based on the number of the target terminals and obtain a plurality of file fragments;
receiving a first file fragment in the plurality of file fragments sent by the server;
acquiring a second file fragment of the plurality of file fragments from the at least one second terminal, wherein the second file fragment is sent to the at least one second terminal by the server, and the second file fragments sent to each second terminal by the server are different;
and generating the target file based on the first file fragment and a second file fragment acquired from the at least one second terminal.
In another aspect, a file obtaining method is provided, where the method is applied to a server, and the method includes:
receiving a first acquisition request of a first terminal, wherein the first acquisition request carries a file identifier of a target file to be acquired and a target terminal number, the target terminal number refers to the total number of the first terminal and at least one second terminal, and the first terminal and the at least one second terminal establish point-to-point communication connection;
acquiring the target file according to the file identifier in the first acquisition request;
according to the number of the target terminals, the target file is segmented to obtain a plurality of file fragments;
and sending a first file fragment of the plurality of file fragments to the first terminal, and sending a second file fragment of the plurality of file fragments to the at least one second terminal, wherein the first file fragment and the second file fragment are used for forming the target file.
In another aspect, an apparatus for obtaining a file is provided, where the apparatus is applied to a first terminal, and the first terminal establishes a peer-to-peer communication connection with at least one second terminal, and the apparatus includes:
an obtaining module, configured to obtain a number of target terminals when an obtaining instruction is received, where the number of target terminals refers to a total number of the first terminal and the at least one second terminal;
a sending module, configured to send a first acquisition request to a server based on the number of target terminals and a file identifier, where the first acquisition request is used to instruct the server to segment a target file based on the number of target terminals and obtain multiple file segments;
a receiving module, configured to receive a first file fragment of the multiple file fragments sent by the server;
the obtaining module is further configured to obtain a second file fragment of the plurality of file fragments from the at least one second terminal, where the second file fragment is sent to the at least one second terminal by the server, and the second file fragments sent by the server to each second terminal are different;
and the generating module is used for generating the target file based on the first file fragment and a second file fragment acquired from the at least one second terminal.
In another aspect, a file obtaining apparatus is provided, where the apparatus is applied to a server, and the apparatus includes:
a receiving module, configured to receive a first acquisition request of a first terminal, where the first acquisition request carries a file identifier of a target file to be acquired and a number of target terminals, where the number of target terminals refers to a total number of the first terminal and at least one second terminal, and the first terminal and the at least one second terminal establish a peer-to-peer communication connection;
the acquisition module is used for acquiring the target file according to the file identifier in the first acquisition request;
the segmentation module is used for segmenting the target file according to the number of the target terminals to obtain a plurality of file segments;
a sending module, configured to send a first file segment of the multiple file segments to the first terminal, and send a second file segment of the multiple file segments to the at least one second terminal, where the first file segment and the second file segment are used to form the target file.
In another aspect, an electronic device is provided, and the electronic device includes a processor and a memory, where the memory stores at least one instruction, and the instruction is loaded and executed by the processor to implement the operation performed by the file obtaining method described above.
In another aspect, a computer-readable storage medium is provided, in which at least one instruction is stored, and the instruction is loaded and executed by a processor to implement the operations performed by the file obtaining method as described above.
The technical scheme provided by the embodiment of the invention has the following beneficial effects:
in the embodiment of the invention, the first terminal sends the first acquisition request to the server based on the number of the target terminals and the file identification, the server firstly segments the target file, then sends the first file segment in the segmented file segments to the first terminal, and sends the second file segment in the file segments to the second terminal, and as the first file segment and the second file segment are both much smaller than the target file, the data volume actually transmitted by the server to each terminal is reduced, the transmission time is reduced, and the waiting time of a user is shortened. And the first terminal acquires the second file fragment from the second terminal through the point-to-point communication connection, and splices the first file fragment and the second file fragment into the target file.
In addition, the server does not need to send complete files to a large number of terminals one by one, actual transmission data volume of the server and network communication data volume of each terminal are reduced, and communication cost for obtaining the files is saved for users.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic illustration of an implementation environment provided by an embodiment of the invention;
fig. 2 is a signaling interaction diagram of a file acquisition method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a file splitting process provided by an embodiment of the invention;
FIG. 4 is a diagram illustrating a process of transferring a file by a server according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a process for sharing a file by multiple terminals according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of a process for splicing files by multiple terminals according to an embodiment of the present invention;
FIG. 7 is a schematic structural diagram of a file retrieving device according to an embodiment of the present invention;
FIG. 8 is a schematic structural diagram of a file retrieving device according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of a terminal according to an embodiment of the present invention;
fig. 10 is a schematic structural diagram of a server according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic diagram of an implementation environment provided by an embodiment of the present invention, where the implementation environment includes: a first terminal 101, a second terminal 102 and a server 103. Wherein a point-to-point communication connection is established between the first terminal 101 and the second terminal 102. The server 103 establishes network communication connections with the first terminal 101 and the second terminal 102, respectively. The first terminal 101 and the second terminal 102 have a download application installed thereon, and the first terminal 101 and the second terminal 102 perform data interaction with the server 103 based on the download application.
The first terminal 101 may be a terminal currently used by a user, the second terminal 102 may be a terminal that establishes a peer-to-peer communication connection with the first terminal 101, and the number of the second terminals 102 may be one or more. The first terminal 101 may send an acquisition request to the server 103 based on the number of terminals of the first terminal 101 and the second terminal 102 to acquire the target file. The first terminal 101 sends a first acquisition request to the server 103, and the second terminal 102 sends a second acquisition request to the server 103. The server 103 firstly segments the target file to obtain a plurality of file segments based on the first obtaining request of the first terminal 101 and the second obtaining request of the second terminal 102. The server sends a first file fragment of the plurality of file fragments to the first terminal 101 and sends a second file fragment of the plurality of file fragments to the second terminal 102. The first terminal 101 and the second terminal 102 share the first file fragment and the second file fragment based on point-to-point communication connection, and both the first terminal 101 and the second terminal 102 can obtain the first file fragment and the second file fragment and splice the first file fragment and the second file fragment to obtain the target file.
The peer-to-peer communication connection may be a local area network connection, a bluetooth connection, or an NFC (Near field communication, or the like). The first terminal 101 and the second terminal 102 may be any terminal with a downloading function, such as installing the downloading application or downloading a plug-in, which is not particularly limited in the embodiment of the present invention.
Fig. 2 is a signaling interaction diagram of a file acquisition method according to an embodiment of the present invention. The embodiment of the present invention is implemented by a first terminal and a server interactively, wherein the first terminal and at least one second terminal establish a peer-to-peer communication connection, referring to fig. 2, the method includes:
201. when the first terminal receives the acquisition instruction, the first terminal acquires the number of target terminals.
The number of target terminals refers to the total number of the first terminal and the at least one second terminal. When the first terminal detects that a target file in the plurality of files is selected, the first terminal receives an acquisition instruction, wherein the acquisition instruction is used for indicating to acquire the selected target file. The first terminal acquires the number of target terminals input in the current interface by the user.
It should be noted that, when the downloading application is started in the first terminal, the first terminal may display file identifiers of a plurality of files on a current display interface, the user may select a file to be downloaded from the plurality of files based on the file identifiers of the plurality of files, when the user selects a file identifier of a target file, the first terminal displays an input option on the current interface, and the first terminal obtains the number of target terminals input by the user in the input option. The target file may be an installation package of an application program, a video file, or other file.
202. And the first terminal sends a first acquisition request to the server based on the number of the target terminals and the file identification.
The first obtaining request is used for indicating the server to segment the target file based on the target terminal number and obtain a plurality of file segments. In this step, the first terminal may obtain the image identification code corresponding to the target terminal number and the file identification according to the target terminal number and the file identification, scan the image identification code, and send an acquisition request to the server.
The image identification code can be generated by any one of the first terminal or the at least one second terminal, and accordingly, the step can be implemented in the following two ways.
In the first method, the image identification code is generated by the first terminal, in this step, the first terminal generates the image identification code according to the number of the target terminals and the file identification, the first terminal displays the image identification code on a display interface, scans the image identification code, and sends the first acquisition request to the server, and the first acquisition request carries the number of the target terminals and the file identification.
Wherein the image identification code is used for indicating to send the acquisition request to the server. The first obtaining request carries the target terminal number and the file identification. The process of the first terminal scanning the image identification code and sending the first acquisition request to the server may be as follows: the image identification code carries the target terminal number and the file identification, the first terminal scans the image identification code, acquires the target terminal number and the file identification, and sends a first acquisition request to a server based on the indication of the image identification code. The image identification code can carry a script instruction, and the first terminal acquires the number of the target terminals and the file identification, executes the script instruction of the image identification code, and sends the first acquisition request to the server.
In a possible implementation manner, since a plurality of terminals need to send acquisition requests to the server, each terminal may correspond to one image identification code, and the first terminal generates a number of image identification codes equal to the number of target terminals according to the number of the target terminals, the file identification and the number of the image identification codes to be generated. The number of each image identification code to be generated is used for indicating the scanning sequence of the first terminal or each second terminal when the first terminal and the at least one second terminal scan the image identification codes in sequence. Then, the first terminal displays the plurality of image identification codes of the target terminal in a display interface, and the first terminal and the second terminal can sequentially scan the plurality of image identification codes of the target terminal and send an acquisition request to the server.
In a possible implementation manner, the first obtaining request may further carry file indication information of the first terminal, where the file indication information is used to indicate a storage condition and/or a transmission condition of a file fragment to be received. Step 202 may also be: the first terminal generates an image identification code according to the number of the target terminals, the file identification and the file indication information of the first terminal; the first terminal displays the image identification code in a display interface, scans the image identification code and sends the first acquisition request to the server.
The file indication information includes but is not limited to: the file size of the file fragment to be received does not exceed the target storage space of the first terminal, and/or the communication data volume for transmitting the file fragment to be received does not exceed the target communication data volume of the first terminal. The first terminal may obtain file indication information of the first terminal and file indication information of the second terminal in advance, and generate an image identification code of the first terminal and an image identification code of the second terminal, respectively, where the first terminal and the second terminal scan the image identification of the terminal.
The target storage space and the target communication data amount may be set based on needs, which is not specifically limited in this embodiment of the present invention. For example, the target storage space may be a remaining storage space currently remaining in the first terminal, and the target communication data amount may be a remaining communication data amount remaining in the first terminal in the current month.
In a second manner, the second terminal generates the image identification code, and this step may be: the first terminal scans the image identification code in the display interface of the at least one second terminal and sends a first acquisition request to the server.
The second terminal may be any one of the at least one second terminal. The image identification code in the display interface of the second terminal is the image identification code generated by the second terminal according to the file identification and the target terminal number, or the second terminal can also generate the image identification code according to the target terminal number, the file identification and the file indication information; and displaying the image identification code in a display interface for scanning by the second terminal and other terminals. The process of generating the image identification code by the second terminal is the same as the process of generating the image identification code by the first terminal, and is not repeated here.
The second terminal can display the image identification code in the display interface, and the first terminal sends the first acquisition request to the server by scanning the image identification code in the display interface of the second terminal. In addition, the process of the first terminal scanning the image identification code displayed by the second terminal is the same as the process of the first terminal scanning the image identification code displayed by the first terminal, and the description is omitted here.
In the embodiment of the present invention, the second terminal also sends a second acquisition request to the server. The process of sending the second acquisition request to the server by the second terminal is the same as the process of sending the first acquisition request by the first terminal, and is not described herein again.
203. The server receives a first acquisition request of the first terminal.
The first obtaining request carries a file identifier of a target file to be obtained and the number of target terminals of the target file. The server receives a first acquisition request of the first terminal, and acquires the file identifier and the number of target terminals from the first acquisition request. In addition, the server can also acquire the number of the image identification code and/or the file indication information of the first terminal from the first acquisition request. The server determines the sending sequence of the first terminal according to the number of the image identification code. In addition, the second terminal also sends a second acquisition request to the server by scanning the image identification code. The server may also receive a second acquisition request of the second terminal. The server may send the file fragments to the plurality of terminals in sequence according to the sending order of each terminal, with the scanning order of each terminal being the sending order of the file fragments to the plurality of terminals. For example, if the number of the image identification code scanned by the first terminal is 5, the scanning order of the first terminal is the fifth among the plurality of terminals. The server may send the file fragments to the first terminal 1 to 4 terminals in the scanning order as a sending order, and then send the file fragments to the first terminal.
204. And the server acquires the target file according to the file identifier in the first acquisition request.
The server stores a plurality of files in advance, and the first terminal acquires the target file according to the file identifier in the first acquisition request.
205. And the server divides the target file according to the number of the target terminals to obtain a plurality of file fragments.
The server divides the target file into a plurality of file fragments of which the number is equal to that of the target terminal according to the number of the target terminals.
In a possible implementation manner, the first obtaining request may further carry file indication information of the first terminal. The step can also be as follows: the server segments the target file into a plurality of file segments according to the file indication information and the number of the target terminals in the first acquisition request, wherein the plurality of file segments include a first file segment meeting the storage condition and/or the transmission condition of the first terminal, and the file indication information is used for indicating the storage condition and/or the transmission condition of the first terminal to-be-received file segments.
As shown in fig. 3, the server may segment a target file into file segments 1, 2, and … … based on acquisition requests of n terminals, and when performing file segmentation, the server may further perform segmentation in combination with file indication information of the terminals, so that each terminal can correspond to a file segment whose file size satisfies the storage condition and/or the transmission condition of the terminal.
It should be noted that the sizes of the file fragments are limited through the file indication information, the factors such as the storage space and the residual flow of each terminal are considered, and the file fragments with the proper sizes are segmented for each terminal, so that the accuracy of file segmentation is improved, the personalized requirements of different users are met, and the user experience is greatly improved.
206. And the server sends a first file fragment in the plurality of file fragments to the first terminal.
The server sends the first file fragment to the first terminal based on the terminal identifier of the first terminal, and sends a second file fragment of the file fragments to the at least one second terminal. And the second file fragments sent to each second terminal by the server are different. The first file fragment and the second file fragment are used for composing the target file. The server may further send, to the first terminal, location information of the first file segment in the target file, and send, to the second terminal, location information of the second file segment in the target file, so that each terminal may subsequently concatenate the plurality of file segments into a complete target file based on the location information of each file segment. The location information of each file fragment may be a storage location of the file fragment in the target file.
In a possible implementation manner, the first obtaining request may also carry the number of the image identification code scanned by the first terminal. Step 206 may also be: the server determines a file fragment with an arrangement sequence matched with the transmission sequence in the plurality of file fragments as the first file fragment according to the transmission sequence of the first terminal indicated by the serial number of the image identification code; and the server sends the first file fragment to the first terminal.
The arrangement order of each file fragment may be the arrangement order of the file fragments in the plurality of file fragments according to the storage location of each file fragment in the target file terminal. The server may determine, as the first file fragment, a file fragment of the plurality of file fragments that is arranged in the same order as the transmission order according to the transmission order of the first terminal.
In a possible implementation manner, the first obtaining request may further carry file indication information of the first terminal. The server determines a file fragment meeting the storage condition and/or the transmission condition of the first terminal from the plurality of file fragments as the first file fragment according to the file indication information of the first terminal, and sends the first file fragment to the first terminal. When the file indication information includes the storage condition of the first terminal, the server determines a file fragment with a file size not exceeding a target storage space of the first terminal among the plurality of file fragments as the first file fragment according to file sizes of the plurality of file fragments. When the file indication information includes the transmission condition of the first terminal, the server determines a file fragment with a file size not exceeding the target communication data volume of the first terminal among the plurality of file fragments as the first file fragment according to the sizes of the plurality of file fragments.
Wherein, the server also sends a second file fragment in the plurality of file fragments to at least one second terminal. The sending process is the same process as the process in which the server sends the first file fragment to the first terminal, and is not described herein again.
It should be noted that the server sequentially sends the file fragments with the arrangement sequence matched with the sending sequence to the plurality of terminals according to the sending sequence of the plurality of terminals and the arrangement sequence of the file fragments, so as to ensure the accuracy of file fragment transmission. In addition, the server divides the target file and sends the divided file fragments to each terminal, and compared with the prior art that each terminal acquires a complete target file from the server, in the embodiment of the invention, the server does not need to send the complete files to a large number of terminals one by one, especially when the file to be transmitted is large, so that the total data volume actually transmitted by the server is reduced, the waiting time of a user is reduced, and the user experience is improved.
207. And the first terminal receives the first file fragment sent by the server.
The first terminal may further receive location information of the first file fragment of the server. Of course, the second terminal also receives the second file fragment of the server.
208. The first terminal acquires the second file fragment from at least one second terminal.
The server sends the second file fragments to the at least one second terminal, wherein the second file fragments sent by the server to each second terminal are different, the first terminal sends a third acquisition request to the second terminal through the point-to-point communication connection based on the second terminal establishing the point-to-point communication connection with the first terminal, and the second terminal sends the second file fragments to the first terminal through the point-to-point communication connection when receiving the third acquisition request. And the first terminal receives the second file fragment through the point-to-point communication connection. In addition, the first terminal may further obtain the location information or the arrangement order of the second file segments from the second terminal.
And the first terminal sends the first file fragment to the second terminal according to the terminal identifier of the second terminal. The process of sending the first file fragment to the second terminal by the first terminal, which is the same process as the process of obtaining the second file fragment from the second terminal by the first terminal, is sent based on the point-to-point communication connection, and is not described herein again.
It should be noted that, as shown in fig. 4, in the conventional file acquiring process, the server needs to send a complete target file to each terminal, and even if the network transmission rate is high, it takes a long time for the server to transmit the whole target file. In contrast, in the embodiment of the present invention, the target file is divided into a plurality of file fragments by the server, and the file fragments are respectively sent to different terminals, without sending the whole target file, the file size of the file fragment sent to each terminal by the server is obviously much smaller than that of the whole target file, and when the transmission rate is 120k per second, the time spent on transmission is obviously reduced, so that the communication data volume of the terminal is greatly saved, and a user with more data traffic can assist the user with more data traffic, thereby realizing traffic resource sharing.
And the plurality of subsequent terminals can acquire other parts of the target file from other terminals of the point-to-point communication connection, and because the transmission rate of the point-to-point communication connection is far greater than that between the server and the terminals, the high-speed sharing of the file among the plurality of terminals can be realized by using the point-to-point communication connection. For example, taking a hundred megabyte local area network as an example, the actual transmission rate is 12M/s, which is much greater than the transmission rate of 120k/s between the server and the terminal, so that the time for the terminal to acquire the file is greatly shortened, the actual file acquisition speed is remarkably improved, and the file acquisition efficiency is improved.
209. And the first terminal generates the target file according to the first file fragment and a second file fragment acquired from at least one second terminal.
In this step, the first terminal splices the first file fragment and the second file fragment into the target file according to the position information of the first file fragment in the target file and the position information of the second file fragment in the target file. Or, the first terminal may further splice the first file fragments and the second file fragments into the target file according to the arrangement order of the first file fragments and the arrangement order of the second file fragments.
As shown in fig. 5, for a plurality of terminals establishing a peer-to-peer communication connection, each terminal shares a file fragment acquired from a server terminal with another terminal, and each terminal acquires file fragments of other terminals, thereby combining the file fragments.
As shown in fig. 6, after each terminal acquires all the file fragments, each terminal performs splicing of multiple file fragments to acquire a complete target file. In fig. 6, taking the terminal 4 as an example, the terminal 4 sequentially splices 4 file fragments according to the position information or the arrangement order of the file fragments, so as to obtain a complete target file, and of course, the terminal 1, the terminal 2, and the terminal 3 also respectively splice files according to the manner of the terminal 4.
In the embodiment of the invention, the first terminal sends the first acquisition request to the server based on the number of the target terminals and the file identification, the server firstly segments the target file, then sends the first file segment in the segmented file segments to the first terminal, and sends the second file segment in the file segments to the second terminal, and as the first file segment and the second file segment are both much smaller than the target file, the data volume actually transmitted by the server to each terminal is reduced, the transmission time is reduced, and the waiting time of a user is shortened. And the first terminal acquires the second file fragment from the second terminal through the point-to-point communication connection, and splices the first file fragment and the second file fragment into the target file.
In addition, the server does not need to send complete files to a large number of terminals one by one, actual transmission data volume of the server and network communication data volume of each terminal are reduced, and communication cost for obtaining the files is saved for users.
Fig. 7 is a schematic structural diagram of a file acquiring apparatus according to an embodiment of the present invention. Referring to fig. 7, the apparatus is applied to a first terminal, and the first terminal establishes a peer-to-peer communication connection with at least one second terminal, and the apparatus includes: the device comprises an acquisition module 701, a sending module 702, a receiving module 703 and a generating module 704.
An obtaining module 701, configured to obtain, when an obtaining instruction is received, a number of target terminals, where the number of target terminals refers to a total number of the first terminal and the at least one second terminal;
a sending module 702, configured to send a first obtaining request to a server based on the number of the target terminals and the file identifier, where the first obtaining request is used to instruct the server to segment a target file based on the number of the target terminals and obtain multiple file segments;
a receiving module 703, configured to receive a first file fragment in the multiple file fragments sent by the server;
the obtaining module 701 is further configured to obtain a second file fragment of the plurality of file fragments from the at least one second terminal, where the second file fragment is sent to the at least one second terminal by the server, and the second file fragments sent by the server to each second terminal are different;
a generating module 704, configured to generate the target file based on the first file segment and a second file segment acquired from the at least one second terminal.
Optionally, the sending module 702 is configured to generate an image identifier according to the number of the target terminals and the file identifier, display the image identifier in a display interface, scan the image identifier, and send the first obtaining request to the server; alternatively, the first and second electrodes may be,
a sending module 702, configured to scan the image identifier in the display interface of the at least one second terminal, and send a first obtaining request to the server;
the image identification code is used for indicating to send an acquisition request to the server, and the first acquisition request carries the target terminal number and the file identification.
Optionally, the sending module 702 is further configured to generate a number of image identification codes equal to the number of the target terminals according to the number of the target terminals, the file identifier, and the number of the image identification codes to be generated;
the number of each image identification code to be generated is used for indicating the scanning sequence of the first terminal or each second terminal when the first terminal and the at least one second terminal scan the image identification codes in sequence.
Optionally, the sending module 702 is further configured to generate an image identifier according to the number of the target terminals, the file identifier, and the file indication information of the first terminal, display the image identifier in a display interface, scan the image identifier, and send the first obtaining request to the server; alternatively, the first and second electrodes may be,
the sending module 702 is further configured to scan the image identifier in the display interface of the at least one second terminal, and send a first obtaining request to the server;
the file indication information is used for indicating storage conditions and/or transmission conditions of file fragments to be received, the image identification code is used for indicating to send an acquisition request to the server, and the first acquisition request carries the number of the target terminals, the file identification and the file indication information of the first terminal.
Optionally, the file indication information includes: the file size of the file fragment to be received does not exceed the target storage space of the first terminal, and/or the communication data volume for transmitting the file fragment to be received does not exceed the target communication data volume of the first terminal.
Optionally, the generating module 704 is configured to splice the first file segment and the second file segment into the target file according to the location information of the first file segment in the target file and the location information of the second file segment in the target file.
Optionally, the sending module 702 is further configured to send the first file fragment to the second terminal according to the terminal identifier of the second terminal.
In the embodiment of the invention, the first terminal sends the first acquisition request to the server based on the number of the target terminals and the file identification, the server firstly segments the target file and then sends the first file segment in the segmented file segments to the first terminal, and the first file segment is much smaller than the target file, so that the actual data transmission amount of the server to each terminal is reduced, the transmission time is reduced, and the waiting time of a user is shortened. And the first terminal acquires the second file fragment from the second terminal through the point-to-point communication connection, and splices the first file fragment and the second file fragment into the target file.
In addition, the server does not need to send complete files to a large number of terminals one by one, actual transmission data volume of the server and network communication data volume of each terminal are reduced, and communication cost for obtaining the files is saved for users.
Fig. 8 is a schematic structural diagram of a file acquiring apparatus according to an embodiment of the present invention. Referring to fig. 8, the apparatus is applied to a server, and includes: a receiving module 801, an obtaining module 802, a cutting module 803 and a sending module 804.
A receiving module 801, configured to receive a first acquisition request of a first terminal, where the first acquisition request carries a file identifier of a target file to be acquired and a number of target terminals, where the number of target terminals refers to a total number of the first terminal and at least one second terminal, and the first terminal and the at least one second terminal establish a peer-to-peer communication connection;
an obtaining module 802, configured to obtain the target file according to the file identifier in the first obtaining request;
a splitting module 803, configured to split the target file according to the number of the target terminals, so as to obtain multiple file segments;
a sending module 804, configured to send a first file segment of the multiple file segments to the first terminal, and send a second file segment of the multiple file segments to the at least one second terminal, where the first file segment and the second file segment are used to form the target file.
Optionally, the sending module 804 is further configured to receive a second obtaining request of the at least one second terminal, and send a second file fragment of the plurality of file fragments to the at least one second terminal.
Optionally, the first obtaining request further carries file indication information of the first terminal, and the segmenting module 803 is further configured to segment the target file into a plurality of file segments according to the file indication information and the number of the target terminals in the first obtaining request;
the file indication information is used for indicating the storage condition and/or the transmission condition of the file fragment to be received.
Optionally, the first obtaining request further carries a number of an image identifier scanned by the first terminal, and the sending module 804 is further configured to determine, as the first file fragment, a file fragment of which an arrangement order is matched with the scanning order, from the plurality of file fragments, according to the scanning order of the first terminal indicated by the number of the image identifier; and sending the first file fragment to the first terminal.
In the embodiment of the invention, when a first acquisition request of a first terminal is received, a server firstly segments a target file, then sends a first file segment in a plurality of file segments after segmentation to the first terminal, and sends a second file segment to at least one second terminal, wherein the first file segment and the second file segment are used for forming the target file.
In addition, the server does not need to send complete files to a large number of terminals one by one, actual transmission data volume of the server and network communication data volume of each terminal are reduced, and communication cost for obtaining the files is saved for users.
All the above optional technical solutions may be combined arbitrarily to form the optional embodiments of the present disclosure, and are not described herein again.
It should be noted that: in the file acquiring apparatus provided in the above embodiment, when acquiring a file, only the division of each function module is illustrated, and in practical applications, the function distribution may be completed by different function modules according to needs, that is, the internal structure of the device is divided into different function modules to complete all or part of the functions described above. In addition, the file acquiring apparatus and the file acquiring method provided by the above embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiments and are not described herein again.
Fig. 9 is a block diagram illustrating a terminal 900 according to an exemplary embodiment of the present invention. The terminal 900 may be: a smart phone, tablet, laptop, desktop, or other intelligent electronic device. Terminal 900 may also be referred to as a user equipment, portable terminal, laptop terminal, desktop terminal, smart terminal, or other name.
In general, terminal 900 includes: a processor 901 and a memory 902.
Processor 901 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and so forth. The processor 901 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 901 may also include a main processor and a coprocessor, where the main processor is a processor for processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 901 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed on the display screen. In some embodiments, the processor 901 may further include an AI (Artificial Intelligence) processor for processing computing operations related to machine learning.
Memory 902 may include one or more computer-readable storage media, which may be non-transitory. The memory 902 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in memory 902 is used to store at least one instruction for execution by processor 901 to implement the file retrieval method provided by the method embodiments herein.
In some embodiments, terminal 900 can also optionally include: a peripheral interface 903 and at least one peripheral. The processor 901, memory 902, and peripheral interface 903 may be connected by buses or signal lines. Various peripheral devices may be connected to the peripheral interface 903 via a bus, signal line, or circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 904, a touch display screen 905, a camera 906, an audio circuit 907, a positioning component 908, and a power supply 909.
The peripheral interface 903 may be used to connect at least one peripheral related to I/O (Input/Output) to the processor 901 and the memory 902. In some embodiments, the processor 901, memory 902, and peripheral interface 903 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 901, the memory 902 and the peripheral interface 903 may be implemented on a separate chip or circuit board, which is not limited by this embodiment.
The Radio Frequency circuit 904 is used for receiving and transmitting RF (Radio Frequency) signals, also called electromagnetic signals. The radio frequency circuitry 904 communicates with communication networks and other communication devices via electromagnetic signals. The radio frequency circuit 904 converts an electrical signal into an electromagnetic signal to transmit, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 904 comprises: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and so forth. The radio frequency circuit 904 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocols include, but are not limited to: metropolitan area networks, various generation mobile communication networks (2G, 3G, 4G, and 5G), Wireless local area networks, and/or WiFi (Wireless Fidelity) networks. In some embodiments, the radio frequency circuit 904 may also include NFC (Near Field Communication) related circuits, which are not limited in this application.
The display screen 905 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display screen 905 is a touch display screen, the display screen 905 also has the ability to capture touch signals on or over the surface of the display screen 905. The touch signal may be input to the processor 901 as a control signal for processing. At this point, the display 905 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display 905 may be one, providing the front panel of the terminal 900; in other embodiments, the number of the display panels 905 may be at least two, and each of the display panels is disposed on a different surface of the terminal 900 or is in a foldable design; in still other embodiments, the display 905 may be a flexible display disposed on a curved surface or a folded surface of the terminal 900. Even more, the display screen 905 may be arranged in a non-rectangular irregular figure, i.e. a shaped screen. The Display panel 905 can be made of LCD (liquid crystal Display), OLED (Organic Light-Emitting Diode), and the like.
The camera assembly 906 is used to capture images or video. Optionally, camera assembly 906 includes a front camera and a rear camera. Generally, a front camera is disposed at a front panel of the terminal, and a rear camera is disposed at a rear surface of the terminal. In some embodiments, the number of the rear cameras is at least two, and each rear camera is any one of a main camera, a depth-of-field camera, a wide-angle camera and a telephoto camera, so that the main camera and the depth-of-field camera are fused to realize a background blurring function, and the main camera and the wide-angle camera are fused to realize panoramic shooting and VR (Virtual Reality) shooting functions or other fusion shooting functions. In some embodiments, camera assembly 906 may also include a flash. The flash lamp can be a monochrome temperature flash lamp or a bicolor temperature flash lamp. The double-color-temperature flash lamp is a combination of a warm-light flash lamp and a cold-light flash lamp, and can be used for light compensation at different color temperatures.
Audio circuit 907 may include a microphone and a speaker. The microphone is used for collecting sound waves of a user and the environment, converting the sound waves into electric signals, and inputting the electric signals to the processor 901 for processing, or inputting the electric signals to the radio frequency circuit 904 for realizing voice communication. For stereo sound acquisition or noise reduction purposes, the microphones may be multiple and disposed at different locations of the terminal 900. The microphone may also be an array microphone or an omni-directional pick-up microphone. The speaker is used to convert electrical signals from the processor 901 or the radio frequency circuit 904 into sound waves. The loudspeaker can be a traditional film loudspeaker or a piezoelectric ceramic loudspeaker. When the speaker is a piezoelectric ceramic speaker, the speaker can be used for purposes such as converting an electric signal into a sound wave audible to a human being, or converting an electric signal into a sound wave inaudible to a human being to measure a distance. In some embodiments, audio circuit 907 may also include a headphone jack.
The positioning component 908 is used to locate the current geographic location of the terminal 900 to implement navigation or LBS (location based Service). The positioning component 908 may be a positioning component based on the GPS (global positioning System) of the united states, the beidou System of china, the graves System of russia, or the galileo System of the european union.
Power supply 909 is used to provide power to the various components in terminal 900. The power source 909 may be alternating current, direct current, disposable or rechargeable. When power source 909 comprises a rechargeable battery, the rechargeable battery may support wired or wireless charging. The rechargeable battery may also be used to support fast charge technology.
In some embodiments, terminal 900 can also include one or more sensors 910. The one or more sensors 910 include, but are not limited to: acceleration sensor 911, gyro sensor 912, pressure sensor 913, fingerprint sensor 914, optical sensor 915, and proximity sensor 916.
The acceleration sensor 911 can detect the magnitude of acceleration in three coordinate axes of the coordinate system established with the terminal 900. For example, the acceleration sensor 911 may be used to detect the components of the gravitational acceleration in three coordinate axes. The processor 901 can control the touch display 905 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 911. The acceleration sensor 911 may also be used for acquisition of motion data of a game or a user.
The gyro sensor 912 may detect a body direction and a rotation angle of the terminal 900, and the gyro sensor 912 may cooperate with the acceleration sensor 911 to acquire a 3D motion of the user on the terminal 900. The processor 901 can implement the following functions according to the data collected by the gyro sensor 912: motion sensing (such as changing the UI according to a user's tilting operation), image stabilization at the time of photographing, game control, and inertial navigation.
Pressure sensors 913 may be disposed on the side bezel of terminal 900 and/or underneath touch display 905. When the pressure sensor 913 is disposed on the side frame of the terminal 900, the user's holding signal of the terminal 900 may be detected, and the processor 901 performs left-right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 913. When the pressure sensor 913 is disposed at a lower layer of the touch display 905, the processor 901 controls the operability control on the UI interface according to the pressure operation of the user on the touch display 905. The operability control comprises at least one of a button control, a scroll bar control, an icon control and a menu control.
The fingerprint sensor 914 is used for collecting a fingerprint of the user, and the processor 901 identifies the user according to the fingerprint collected by the fingerprint sensor 914, or the fingerprint sensor 914 identifies the user according to the collected fingerprint. Upon recognizing that the user's identity is a trusted identity, processor 901 authorizes the user to perform relevant sensitive operations including unlocking the screen, viewing encrypted information, downloading software, paying, and changing settings, etc. The fingerprint sensor 914 may be disposed on the front, back, or side of the terminal 900. When a physical key or vendor Logo is provided on the terminal 900, the fingerprint sensor 914 may be integrated with the physical key or vendor Logo.
The optical sensor 915 is used to collect ambient light intensity. In one embodiment, the processor 901 may control the display brightness of the touch display 905 based on the ambient light intensity collected by the optical sensor 915. Specifically, when the ambient light intensity is high, the display brightness of the touch display screen 905 is increased; when the ambient light intensity is low, the display brightness of the touch display screen 905 is turned down. In another embodiment, the processor 901 can also dynamically adjust the shooting parameters of the camera assembly 906 according to the ambient light intensity collected by the optical sensor 915.
Proximity sensor 916, also known as a distance sensor, is typically disposed on the front panel of terminal 900. The proximity sensor 916 is used to collect the distance between the user and the front face of the terminal 900. In one embodiment, when the proximity sensor 916 detects that the distance between the user and the front face of the terminal 900 gradually decreases, the processor 901 controls the touch display 905 to switch from the bright screen state to the dark screen state; when the proximity sensor 916 detects that the distance between the user and the front surface of the terminal 900 gradually becomes larger, the processor 901 controls the touch display 905 to switch from the breath screen state to the bright screen state.
Those skilled in the art will appreciate that the configuration shown in fig. 9 does not constitute a limitation of terminal 900, and may include more or fewer components than those shown, or may combine certain components, or may employ a different arrangement of components.
Fig. 10 is a schematic structural diagram of a server according to an embodiment of the present invention, where the server 1000 may generate a relatively large difference due to different configurations or performances, and may include one or more processors (CPUs) 1001 and one or more memories 1002, where the memory 1002 stores at least one instruction, and the at least one instruction is loaded and executed by the processors 1001 to implement the file obtaining method provided by each method embodiment. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input/output interface, so as to perform input/output, and the server may also include other components for implementing the functions of the device, which are not described herein again.
In an exemplary embodiment, there is also provided a computer-readable storage medium, such as a memory, comprising instructions executable by a processor in a terminal to perform the file retrieval method in the above embodiments. For example, the computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (24)

1. A file acquisition method applied to a first terminal, wherein the first terminal establishes a peer-to-peer communication connection with at least one second terminal, and the method comprises:
when an acquisition instruction is received, acquiring the number of target terminals and a file identifier, wherein the number of the target terminals refers to the total number of the first terminal and the at least one second terminal;
scanning an image identification code, and sending a first acquisition request to a server, wherein the first acquisition request is used for indicating the server to segment a target file based on the number of target terminals and obtain a plurality of file segments, the image identification code is generated by any one of the first terminal or the at least one second terminal according to the number of the target terminals and the file identification, and the first acquisition request carries the number of the target terminals and the file identification;
receiving a first file fragment in the plurality of file fragments sent by the server;
acquiring a second file fragment in the plurality of file fragments from the at least one second terminal, wherein the second file fragment is sent to the at least one second terminal by the server, the second terminal sends a second acquisition request to the server by scanning the image identification code, the server sends the second file fragment to the second terminal according to the second acquisition request, and the second file fragments sent to each second terminal by the server are different;
and generating the target file based on the first file fragment and a second file fragment acquired from the at least one second terminal.
2. The method of claim 1, wherein sending a first acquisition request to a server based on the scanning of the image identification code comprises:
generating an image identification code according to the number of the target terminals and the file identification, displaying the image identification code in a display interface, scanning the image identification code, and sending the first acquisition request to the server; alternatively, the first and second electrodes may be,
scanning the image identification code in the display interface of the at least one second terminal, and sending a first acquisition request to the server;
the image identification code is used for indicating to send an acquisition request to the server, and the first acquisition request carries the target terminal number and the file identification.
3. The method of claim 2, wherein the generating an image identification code according to the number of target terminals and the file identification comprises:
generating a plurality of image identification codes with the number equal to that of the target terminal according to the number of the target terminal, the file identification and the number of the image identification codes to be generated;
the number of each image identification code to be generated is used for indicating the scanning sequence of the first terminal or each second terminal when the first terminal and the at least one second terminal scan the image identification codes in sequence.
4. The method of claim 1, wherein scanning the image identification code and sending the first request to the server comprises:
generating an image identification code according to the number of the target terminals, the file identification and the file indication information of the first terminal, displaying the image identification code in a display interface, scanning the image identification code, and sending the first acquisition request to the server; alternatively, the first and second electrodes may be,
scanning the image identification code in the display interface of the at least one second terminal, and sending a first acquisition request to the server;
the file indication information is used for indicating storage conditions and/or transmission conditions of file fragments to be received, the image identification code is used for indicating to send an acquisition request to the server, and the first acquisition request carries the number of the target terminals, the file identification and the file indication information of the first terminal.
5. The method according to claim 4, wherein the file indication information comprises: the file size of the file fragment to be received does not exceed the target storage space of the first terminal, and/or the communication data volume for transmitting the file fragment to be received does not exceed the target communication data volume of the first terminal.
6. The method according to claim 1, wherein the generating the target file based on the first file fragment and a second file fragment obtained from the at least one second terminal comprises:
and splicing the first file fragment and the second file fragment into the target file according to the position information of the first file fragment in the target file and the position information of the second file fragment in the target file.
7. The method of claim 1, further comprising:
and sending the first file fragment to the second terminal according to the terminal identifier of the second terminal.
8. A file acquisition method is applied to a server, and the method comprises the following steps:
receiving a first acquisition request of a first terminal and a second acquisition request of at least one second terminal, wherein the first acquisition request carries a file identifier of a target file to be acquired and the number of target terminals, the number of target terminals refers to the total number of the first terminal and the at least one second terminal, the first terminal and the at least one second terminal establish point-to-point communication connection, the first acquisition request is sent by the first terminal scanning an image identifier, the image identifier is generated by the first terminal or any one of the at least one second terminal according to the number of target terminals and the file identifier, and the second acquisition request is sent by the second terminal by scanning the image identifier;
acquiring the target file according to the file identifier in the first acquisition request;
according to the number of the target terminals, the target file is segmented to obtain a plurality of file fragments;
and sending a first file fragment of the plurality of file fragments to the first terminal, and sending a second file fragment of the plurality of file fragments to the at least one second terminal, wherein the first file fragment and the second file fragment are used for forming the target file.
9. The method of claim 8, further comprising:
and receiving a second acquisition request of the at least one second terminal, and sending a second file fragment of the plurality of file fragments to the at least one second terminal.
10. The method of claim 8, wherein the first obtaining request further carries file indication information of the first terminal, and the splitting the target file according to the number of the target terminals to obtain a plurality of file fragments comprises:
according to the file indication information and the target terminal number in the first acquisition request, the target file is segmented into a plurality of file segments;
the file indication information is used for indicating the storage condition and/or the transmission condition of the file fragment to be received.
11. The method of claim 9, wherein the first obtaining request further carries a number of an image identifier scanned by the first terminal, and wherein sending the first file fragment of the plurality of file fragments to the first terminal comprises:
determining a file fragment with an arrangement sequence matched with the scanning sequence in the plurality of file fragments as the first file fragment according to the scanning sequence of the first terminal indicated by the serial number of the image identification code;
and sending the first file fragment to the first terminal.
12. A file obtaining apparatus, applied to a first terminal, where the first terminal establishes a peer-to-peer communication connection with at least one second terminal, the apparatus comprising:
an obtaining module, configured to obtain, when an obtaining instruction is received, a target terminal number and a file identifier, where the target terminal number is a total number of the first terminal and the at least one second terminal;
a sending module, configured to scan an image identification code, and send a first acquisition request to a server, where the first acquisition request is used to instruct the server to segment a target file based on the number of target terminals and obtain multiple file segments, the image identification code is generated by any one of the first terminal or the at least one second terminal according to the number of target terminals and the file identifier, and the first acquisition request carries the number of target terminals and the file identifier;
a receiving module, configured to receive a first file fragment of the multiple file fragments sent by the server;
the acquiring module is further configured to acquire a second file fragment of the plurality of file fragments from the at least one second terminal, where the second file fragment is sent to the at least one second terminal by the server, where the second terminal sends a second acquiring request to the server by scanning the image identification code, the server sends the second file fragment to the second terminal according to the second acquiring request, and the second file fragments sent by the server to each second terminal are different;
and the generating module is used for generating the target file based on the first file fragment and a second file fragment acquired from the at least one second terminal.
13. The apparatus according to claim 12, wherein the sending module is configured to generate an image identification code according to the number of the target terminals and the file identifier, display the image identification code in a display interface, scan the image identification code, and send the first obtaining request to a server; alternatively, the first and second electrodes may be,
the sending module is further configured to scan the image identification code in the display interface of the at least one second terminal, and send a first acquisition request to the server;
the image identification code is used for indicating to send an acquisition request to the server, and the first acquisition request carries the target terminal number and the file identification.
14. The apparatus according to claim 13, wherein the sending module is further configured to generate a number of image identification codes equal to the number of target terminals according to the number of the target terminals, the file identifier, and the number of the image identification codes to be generated;
the number of each image identification code to be generated is used for indicating the scanning sequence of the first terminal or each second terminal when the first terminal and the at least one second terminal scan the image identification codes in sequence.
15. The apparatus according to claim 12, wherein the sending module is further configured to generate an image identification code according to the number of the target terminals, the file identifier, and the file indication information of the first terminal, display the image identification code in a display interface, scan the image identification code, and send the first obtaining request to the server; alternatively, the first and second electrodes may be,
the sending module is further configured to scan the image identification code in the display interface of the at least one second terminal, and send a first acquisition request to the server;
the file indication information is used for indicating storage conditions and/or transmission conditions of file fragments to be received, the image identification code is used for indicating to send an acquisition request to the server, and the first acquisition request carries the number of the target terminals, the file identification and the file indication information of the first terminal.
16. The apparatus of claim 15, wherein the file indication information comprises: the file size of the file fragment to be received does not exceed the target storage space of the first terminal, and/or the communication data volume for transmitting the file fragment to be received does not exceed the target communication data volume of the first terminal.
17. The apparatus according to claim 12, wherein the generating module is configured to splice the first file segment and the second file segment into the target file according to location information of the first file segment in the target file and location information of the second file segment in the target file.
18. The apparatus of claim 12, wherein the sending module is further configured to send the first file fragment to the second terminal according to a terminal identifier of the second terminal.
19. A file acquisition apparatus, wherein the apparatus is applied to a server, the apparatus comprising:
a receiving module, configured to receive a first acquisition request of a first terminal, and receive a second acquisition request of at least one second terminal, where the first acquisition request carries a file identifier of a target file to be acquired and a number of target terminals, the number of target terminals refers to a total number of the first terminal and the at least one second terminal, the first terminal establishes a peer-to-peer communication connection with the at least one second terminal, the first acquisition request is sent by the first terminal scanning an image identifier, the image identifier is generated by the first terminal or any one of the at least one second terminal according to the number of target terminals and the file identifier, and the second acquisition request is sent by the second terminal by scanning the image identifier;
the acquisition module is used for acquiring the target file according to the file identifier in the first acquisition request;
the segmentation module is used for segmenting the target file according to the number of the target terminals to obtain a plurality of file segments;
a sending module, configured to send a first file segment of the multiple file segments to the first terminal, and send a second file segment of the multiple file segments to the at least one second terminal, where the first file segment and the second file segment are used to form the target file.
20. The apparatus of claim 19, wherein the sending module is further configured to receive a second obtaining request of the at least one second terminal, and send a second file slice of the plurality of file slices to the at least one second terminal.
21. The apparatus according to claim 19, wherein the first obtaining request further carries file indication information of the first terminal, and the splitting module is further configured to split the target file into a plurality of file fragments according to the file indication information and the number of target terminals in the first obtaining request;
the file indication information is used for indicating the storage condition and/or the transmission condition of the file fragment to be received.
22. The apparatus according to claim 20, wherein the first obtaining request further carries a number of an image identifier scanned by the first terminal, and the sending module is further configured to determine, as the first file fragment, a file fragment whose arrangement order matches the scanning order among the plurality of file fragments according to the scanning order of the first terminal indicated by the number of the image identifier; and sending the first file fragment to the first terminal.
23. An electronic device, comprising a processor and a memory, wherein at least one instruction is stored in the memory, and the instruction is loaded and executed by the processor to implement the operations performed by the file acquisition method according to any one of claims 1 to 7 or 8 to 11.
24. A computer-readable storage medium having stored therein at least one instruction which is loaded and executed by a processor to perform operations performed by the file retrieval method of any one of claims 1 to 7 or 8 to 11.
CN201811309346.4A 2018-11-05 2018-11-05 File acquisition method and device, electronic equipment and storage medium Active CN109413190B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811309346.4A CN109413190B (en) 2018-11-05 2018-11-05 File acquisition method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811309346.4A CN109413190B (en) 2018-11-05 2018-11-05 File acquisition method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109413190A CN109413190A (en) 2019-03-01
CN109413190B true CN109413190B (en) 2020-09-04

Family

ID=65471480

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811309346.4A Active CN109413190B (en) 2018-11-05 2018-11-05 File acquisition method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109413190B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111935221B (en) * 2020-07-03 2023-04-28 Oppo(重庆)智能科技有限公司 File transmission method, device, storage medium and terminal
CN113472905A (en) * 2021-09-06 2021-10-01 广州朗国电子科技股份有限公司 Universal file accelerated transmission method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102546768A (en) * 2011-12-23 2012-07-04 深圳市同洲电子股份有限公司 Content sharing method, device and system
CN102801784A (en) * 2012-07-03 2012-11-28 华为技术有限公司 Distributed type data storing method and equipment
CN103402229A (en) * 2013-07-25 2013-11-20 中国科学院信息工程研究所 Data downloading method and data downloading system
CN105120530A (en) * 2015-09-11 2015-12-02 北京金山安全软件有限公司 Method and device for acquiring data and data acquisition system

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070016960A1 (en) * 2005-07-18 2007-01-18 Nt Objectives, Inc. NTO input validation technique
CN104052774B (en) * 2013-03-14 2019-03-01 腾讯科技(深圳)有限公司 A kind of data transmission method and system
CN104092713B (en) * 2013-05-31 2018-06-15 腾讯科技(深圳)有限公司 The download information methods of exhibiting and device of a kind of Internet resources

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102546768A (en) * 2011-12-23 2012-07-04 深圳市同洲电子股份有限公司 Content sharing method, device and system
CN102801784A (en) * 2012-07-03 2012-11-28 华为技术有限公司 Distributed type data storing method and equipment
CN103402229A (en) * 2013-07-25 2013-11-20 中国科学院信息工程研究所 Data downloading method and data downloading system
CN105120530A (en) * 2015-09-11 2015-12-02 北京金山安全软件有限公司 Method and device for acquiring data and data acquisition system

Also Published As

Publication number Publication date
CN109413190A (en) 2019-03-01

Similar Documents

Publication Publication Date Title
CN110278464B (en) Method and device for displaying list
CN110784370B (en) Method and device for testing equipment, electronic equipment and medium
CN110147503B (en) Information issuing method and device, computer equipment and storage medium
CN111159604A (en) Picture resource loading method and device
CN110569220A (en) Game resource file display method and device, terminal and storage medium
CN112667835A (en) Work processing method and device, electronic equipment and storage medium
CN111083513B (en) Live broadcast picture processing method and device, terminal and computer readable storage medium
CN110677713B (en) Video image processing method and device and storage medium
CN110290191B (en) Resource transfer result processing method, device, server, terminal and storage medium
CN109783176B (en) Page switching method and device
CN109819314B (en) Audio and video processing method and device, terminal and storage medium
CN108401194B (en) Time stamp determination method, apparatus and computer-readable storage medium
CN111083554A (en) Method and device for displaying live gift
CN109413190B (en) File acquisition method and device, electronic equipment and storage medium
CN110912830A (en) Method and device for transmitting data
CN112616082A (en) Video preview method, device, terminal and storage medium
CN112118353A (en) Information display method, device, terminal and computer readable storage medium
CN109033473B (en) Picture sharing method and device and computer readable storage medium
CN110366044B (en) Method, device and system for acquiring target object
CN111464829B (en) Method, device and equipment for switching media data and storage medium
CN111369434B (en) Method, device, equipment and storage medium for generating spliced video covers
CN111064657B (en) Method, device and system for grouping concerned accounts
CN110971692B (en) Method and device for opening service and computer storage medium
CN112988254B (en) Method, device and equipment for managing hardware equipment
CN109189525B (en) Method, device and equipment for loading sub-page and computer readable storage medium

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
GR01 Patent grant
GR01 Patent grant