CN109286641B - File transmission method and device - Google Patents

File transmission method and device Download PDF

Info

Publication number
CN109286641B
CN109286641B CN201710590282.9A CN201710590282A CN109286641B CN 109286641 B CN109286641 B CN 109286641B CN 201710590282 A CN201710590282 A CN 201710590282A CN 109286641 B CN109286641 B CN 109286641B
Authority
CN
China
Prior art keywords
file
files
terminal
transmitted
folder
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
CN201710590282.9A
Other languages
Chinese (zh)
Other versions
CN109286641A (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 CN201710590282.9A priority Critical patent/CN109286641B/en
Publication of CN109286641A publication Critical patent/CN109286641A/en
Application granted granted Critical
Publication of CN109286641B publication Critical patent/CN109286641B/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/10Protocols in which an application is distributed across nodes in the network
    • 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/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1014Server selection for load balancing based on the content of a request
    • 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
    • H04L67/1074Peer-to-peer [P2P] networks for supporting data block transmission mechanisms
    • H04L67/1078Resource delivery mechanisms
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/63Routing a service request depending on the request content or context

Landscapes

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

Abstract

The embodiment of the invention discloses a file transmission method, which comprises the following steps: acquiring a folder to be transmitted, which is used for being transmitted from a first terminal to a second terminal, wherein the folder to be transmitted is a folder which is selected by the first terminal and contains at least two files; classifying at least two files contained in the folder to be transmitted to obtain at least a first type of file and a second type of file; and correspondingly transmitting the first type of file and the second type of file to the second terminal from the first transmission channel and the second transmission channel in parallel by at least utilizing a first transmission channel established by the first terminal and the second terminal and a second transmission channel established by the second terminal and a target server, wherein the target server stores the second type of file. The embodiment of the invention also discloses a file transmission device.

Description

File transmission method and device
Technical Field
The present invention relates to information transmission technologies, and in particular, to a file transmission method and apparatus.
Background
In the prior art, when a folder is transmitted, a sender terminal and a receiver terminal need to be on line simultaneously, and files in the folder to be transmitted need to be sequentially and serially transmitted to the receiver terminal in the transmission process, so that the transmission efficiency is bound by the bandwidth, for example, the transmission time is bound by the size of the folder to be transmitted, the uploading bandwidth and the like, and the possibility of shortening the transmission time and improving the transmission efficiency is further limited. Therefore, a file transmission method is needed to solve the above problems.
Disclosure of Invention
In order to solve the existing technical problem, the embodiment of the invention provides a file transmission method and a file transmission device.
The technical scheme of the embodiment of the invention is realized as follows:
a first aspect of an embodiment of the present invention provides a file transmission method, where the method includes:
acquiring a folder to be transmitted, which is used for being transmitted from a first terminal to a second terminal, wherein the folder to be transmitted is a folder which is selected by the first terminal and contains at least two files;
classifying at least two files contained in the folder to be transmitted to obtain at least a first type of file and a second type of file;
and correspondingly transmitting the first type of file and the second type of file to the second terminal from the first transmission channel and the second transmission channel in parallel by at least utilizing a first transmission channel established by the first terminal and the second terminal and a second transmission channel established by the second terminal and a target server, wherein the target server stores the second type of file.
In the foregoing solution, the classifying at least two files included in the folder to be transmitted includes:
inquiring whether the target server stores the files contained in the folder to be transmitted or not;
and classifying at least two files contained in the folder to be transmitted at least based on the query result.
In the foregoing solution, the classifying at least two files included in the folder to be transmitted includes:
acquiring file characteristic information of each file contained in the file to be transmitted, and selecting a first file of which the file characteristic information meets a preset rule from at least two files contained in the folder to be transmitted;
and classifying other files except the first file in the folder to be transmitted.
In the above solution, the file characteristic information at least includes a file size; the selecting of the first file with file characteristic information meeting a preset rule from the at least two files contained in the folder to be transmitted includes:
selecting a first file with the file size smaller than a preset numerical value from at least two files contained in the folder to be transmitted;
the method further comprises the following steps:
controlling the first terminal to merge all the first files into a first target file with the file size larger than the preset value;
controlling the first terminal to transmit all the first target files to the second terminal after N1 times of successful communication handshake between the first terminal and the second terminal at most; the N1 is a positive integer which is greater than or equal to 1 and smaller than the number of the first files in the folder to be transmitted.
In the above scheme, the method further comprises:
acquiring file characteristic information of each file in the first type of files, and selecting a first file of which the file characteristic information meets a preset rule from the files contained in the first type of files;
the step of transmitting the first type of file from the first transmission channel to the second terminal comprises:
controlling the first terminal to merge all the first files in the first type of files into a second target file containing at least two first files;
controlling the first terminal to transmit all the second target files to the second terminal after at most N2 times of successful communication handshake between the first terminal and the second terminal; wherein, the N2 is a positive integer which is greater than or equal to 1 and less than the number of all the first files in the first type of files; and controlling the first terminal to transmit other files except the first file in the first type of files to the second terminal by using the first transmission channel.
In the above scheme, the method further comprises:
acquiring file characteristic information of each file in the second type of files, and selecting a first file of which the file characteristic information meets a preset rule from the files contained in the second type of files;
the step of transmitting the second type of file from the second transmission channel to the second terminal comprises:
controlling a target server storing the second type of files to merge all the first files in the second type of files into a third target file containing at least two first files;
and controlling the target server to transmit all the third target files to the second terminal after the communication handshake between the target server and the second terminal is successful, and controlling the target server to transmit other files except the first file in the second type of files to the second terminal by using the second transmission channel.
A second aspect of an embodiment of the present invention provides a file transfer apparatus, where the apparatus includes:
the file transmission method comprises the steps that an obtaining unit is used for obtaining a folder to be transmitted, wherein the folder to be transmitted is used for being transmitted from a first terminal to a second terminal, and the folder to be transmitted is a folder which is selected by the first terminal and contains at least two files;
the classification processing unit is used for classifying at least two files contained in the folder to be transmitted to obtain at least a first class of files and a second class of files, wherein each class of files contains at least one file;
and the control unit is used for correspondingly transmitting the first type of files and the second type of files from the first transmission channel and the second transmission channel to the second terminal in parallel by using at least the first transmission channel established by the first terminal and the second transmission channel established by the second terminal and a target server, wherein the second type of files are stored in the target server.
In the above scheme, the classification processing unit is further configured to query whether the target server stores the file included in the folder to be transmitted; and classifying at least two files contained in the folder to be transmitted at least based on the query result.
In the above scheme, the obtaining unit is further configured to obtain file feature information of each file included in the file to be transmitted;
the classification processing unit is further used for selecting a first file of which the file characteristic information meets a preset rule from at least two files contained in the folder to be transmitted; and classifying other files except the first file in the folder to be transmitted.
In the above solution, the file characteristic information at least includes a file size;
the classification processing unit is further used for selecting a first file with a file size smaller than a preset numerical value from at least two files contained in the folder to be transmitted;
the control unit is further configured to control the first terminal to perform merging processing on all first files, and merge the first files into a first target file with a file size larger than the preset value; controlling the first terminal to transmit all the first target files to the second terminal after the communication handshake between the first terminal and the second terminal is successful at most N1 times; the N1 is a positive integer which is greater than or equal to 1 and smaller than the number of the first files in the folder to be transmitted.
In the above scheme, the obtaining unit is further configured to obtain file feature information of each file in the first class of files;
the classification processing unit is further configured to select a first file, of which file feature information meets a preset rule, from files included in the first class of files;
the control unit is further configured to control the first terminal to perform merging processing on all the first files in the first class of files, and merge the first files into a second target file including at least two first files; controlling the first terminal to transmit all the second target files to the second terminal after at most N2 times of successful communication handshake between the first terminal and the second terminal; wherein, the N2 is a positive integer which is greater than or equal to 1 and less than the number of all the first files in the first type of files; and controlling the first terminal to transmit other files except the first file in the first type of files to the second terminal by using the first transmission channel.
In the above scheme, the obtaining unit is further configured to obtain file feature information of each file in the second class of files;
the classification processing unit is further configured to select a first file, of which file feature information meets a preset rule, from files included in the second class of files;
the control unit is further configured to control the target server storing the second type of file to merge all the first files in the second type of file into a third target file including at least two first files; and controlling the target server to transmit all the third target files to the second terminal after one-time communication handshake between the target server terminal and the second terminal is successful, and controlling the target server to transmit other files except the first file in the second type of files to the second terminal by using the second transmission channel.
The file transmission method and the device thereof in the embodiment of the invention obtain the first type of files and the second type of files by classifying the files in the folder to be transmitted, transmit the first type of files to the second terminal by using the first terminal, and transmit the second type of files to the second terminal by using the target server based on the offline file transmission characteristic, thereby realizing the purpose of transmitting all the files in the folder to be transmitted to the second terminal in parallel by using different devices; further, the embodiment of the invention realizes that the files in the folder to be transmitted are transmitted to the second terminal in parallel, namely, part of the files in the folder to be transmitted are not transmitted to the second terminal by the first terminal, in other words, the first terminal only transmits part of the files in the folder to be transmitted to the second terminal, so that compared with the existing transmission mode of transmitting the folder, the embodiment of the invention reduces the influence degree of bandwidth on the transmission efficiency, increases the possibility of improving the transmission efficiency, and lays a foundation for improving the transmission efficiency.
Drawings
FIG. 1 is a schematic diagram of a flow chart of a file transmission method according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating a process of classifying folders to be transmitted according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a transmission flow of a first terminal transmitting a folder to be transmitted to a second terminal according to an embodiment of the present invention;
FIG. 4 is a diagram illustrating a process of classifying folders to be transmitted according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a transmission flow of a second first terminal transmitting a folder to be transmitted to a second terminal according to an embodiment of the present invention;
FIG. 6 is a diagram illustrating a third embodiment of the present invention for classifying folders to be transmitted;
fig. 7 is a schematic diagram of a transmission flow of transmitting a folder to be transmitted from a first terminal to a second terminal according to a third embodiment of the present invention;
fig. 8 is a schematic flow chart illustrating an implementation process of the file transmission method in a specific application scenario according to an embodiment of the present invention;
FIG. 9 is a schematic diagram of a component structure of a document transportation apparatus according to an embodiment of the present invention;
fig. 10 is a schematic diagram of a hardware structure of a file transfer device according to an embodiment of the present invention.
Detailed Description
So that the manner in which the features and aspects of the present invention can be understood in detail, a more particular description of the invention, briefly summarized above, may be had by reference to embodiments, some of which are illustrated in the appended drawings.
Example one
The embodiment provides a file transmission method, which can be particularly applied to a file transmission device; in practical applications, the file transmission device may be a terminal, such as a mobile terminal like a mobile phone or a tablet computer, or a non-mobile terminal like a personal computer. Further, the terminal may specifically be a sender terminal that sends the folder to be transmitted, that is, the first terminal in this embodiment, or specifically a receiver terminal that receives the folder to be transmitted, that is, the second terminal in this embodiment, that is, the method in this embodiment may be implemented by the receiver terminal, may also be implemented by the sender terminal, and may also be implemented by interacting between the receiver terminal and the sender terminal. In particular, the amount of the solvent to be used,
fig. 1 is a schematic view of an implementation flow of a file transmission method according to an embodiment of the present invention, and as shown in fig. 1, the method includes:
step 101: acquiring a folder to be transmitted, which is used for being transmitted from a first terminal to a second terminal, wherein the folder to be transmitted is a folder which is selected by the first terminal and contains at least two files;
in practical applications, the folder to be transmitted may be determined by the first terminal based on a selected operation of a user.
Step 102: classifying at least two files contained in the folder to be transmitted to obtain at least a first type of file and a second type of file;
in a specific embodiment, each type of file comprises at least one file;
in a specific embodiment, the folders to be transmitted can be classified in the following manner; specifically, whether the target server stores the files contained in the folder to be transmitted is queried, and at least two files contained in the folder to be transmitted are classified based on a query result. For example, as shown in fig. 2, the folders to be transmitted are classified based on whether files exist in the target server, and files in the folders to be transmitted that are stored in the target server are taken as files of the second type, and files in the folders to be transmitted that are not stored in the target server are taken as files of the first type. Therefore, a foundation is laid for parallel transmission of the files in the folder to be transmitted to the second terminal through different channels by using different devices, such as the first terminal and the target server, correspondingly.
Here, in practical applications, the target server may be specifically an offline file server, and the offline file server is used for sending an offline file, for example, when a sender terminal uses instant messaging software to transmit a file to a receiver terminal, and the receiver terminal is not in an online state (e.g. in an offline state or in a stealth state), the sender terminal may first upload the file to the offline file server and then send a file message to the receiver terminal, and after the receiver terminal knows the file message, the receiver terminal downloads the file from the offline file server by using a transmission channel between the offline server and the receiver terminal, so as to achieve the purpose that the sender terminal sends the file to the receiver terminal that is not in the online state, that is, when sending the offline file, the sender terminal and the receiver terminal operate asynchronously, the sender terminal is not required to be online at the same time, for example, the sender terminal is in an online state, but the receiver terminal may not be in an online state (for example, in an offline state, a stealth state, etc.). Therefore, when the file transmission device of this embodiment controls the first terminal to send the folder to be transmitted to the second terminal, the file transmission device may first send an inquiry request to the offline file server to inquire whether the target server stores the file included in the folder to be transmitted, so as to facilitate the offline file server to assist the first terminal to send the folder to be transmitted to the second terminal.
Step 103: and correspondingly transmitting the first type of file and the second type of file to the second terminal from the first transmission channel and the second transmission channel in parallel at least by using a first transmission channel established by the first terminal and the second terminal and a second transmission channel established by the second terminal and a target server, so that the second terminal can acquire all files in the folder to be transmitted from different transmission channels in parallel, wherein the target server stores the second type of file.
That is to say, as shown in fig. 3, a first type of file in the folder to be transmitted is sent to the second terminal by using the first terminal, that is, by using the first transmission channel established between the first terminal and the second terminal, and a second type of file in the folder to be transmitted is sent to the second terminal by using the target server, that is, by using the second transmission channel established between the second terminal and the target server, where the first terminal uses the first transmission channel and the target server uses the second transmission channel to send the file to the second terminal, the process of the second terminal obtaining the folder to be transmitted by the first terminal to the second terminal can be executed in parallel, so that the obtaining manner of the second terminal obtaining the folder to be transmitted by the first terminal is expanded, and a foundation is laid for shortening the transmission time and improving the transmission efficiency.
In this way, the method according to the embodiment of the present invention obtains the first type of file and the second type of file by classifying the files in the folder to be transmitted, transmits the first type of file to the second terminal by using the first terminal, and transmits the second type of file to the second terminal by using the target server based on the offline file transmission characteristic, thereby achieving the purpose of transmitting all the files in the folder to be transmitted to the second terminal in parallel by using different devices; further, the embodiment of the invention realizes that the files in the folder to be transmitted are transmitted to the second terminal in parallel, namely, part of the files in the folder to be transmitted are not transmitted to the second terminal by the first terminal, in other words, the first terminal only transmits part of the files in the folder to be transmitted to the second terminal, so that compared with the existing transmission mode of transmitting the folder, the embodiment of the invention reduces the influence degree of bandwidth on the transmission efficiency, increases the possibility of improving the transmission efficiency, and lays a foundation for improving the transmission efficiency.
Example two
Based on the method in the first embodiment, this embodiment provides another file classification manner, and specifically, the file feature information of each file included in the file to be transmitted is obtained, a first file whose file feature information meets a preset rule is selected from at least two files included in the folder to be transmitted, and then classification processing is performed on other files in the folder to be transmitted except the first file. That is to say, in this embodiment, the file transmission device may classify other files except the first file in the folder to be transmitted. Specifically, as shown in fig. 4, the file transmission device may screen the folder to be transmitted based on a preset rule, screen out a file meeting the preset rule as a first file, and then classify other files, that is, non-first files, in the folder to be transmitted except for all the first files to obtain a first type of file and a second type of file. Here, the classification processing may be performed in a manner as described in fig. 2, that is, classifying non-first files based on whether or not files exist in the target server, for example, using non-first files in the folder to be transmitted that are stored in the target server as second-class files, and using non-first files in the folder to be transmitted that are not stored in the target server as first-class files, to complete the classification process of the non-first files.
Further, in a specific embodiment, the file characteristic information at least includes a file size, and accordingly, the selecting a first file whose file characteristic information satisfies a preset rule from at least two files included in the folder to be transmitted specifically includes: selecting a first file with the file size smaller than a preset numerical value from at least two files contained in the folder to be transmitted; for example, the preset value is 1M, at this time, the selected first file is a small file, and in practical application, when there are many small files in the folder to be transmitted, since communication handshake is required between the first terminal and the second terminal for each file transmission, when there are many small files, connection overhead is inevitably increased, and transmission efficiency is reduced. Specifically, the file transmission device controls the first terminal to perform merging processing on all first files, and merge the first files into a first target file with a file size larger than the preset value, or merge the first target file with a file size larger than the first value and smaller than or equal to a second value, so as to control the first terminal to transmit all the first target files to the second terminal after at most N1 times of successful communication handshake between the first terminal and the second terminal; the N1 is a positive integer which is greater than or equal to 1 and smaller than the number of the first files in the folder to be transmitted. That is to say, in the range of the number of communication handshakes of the number of the first files, the entire content of the first target file is transmitted to the second terminal, so compared with the conventional transmission method in which all the first files are transmitted to the second terminal only when the number of communication handshakes is the same as the number of the first files, the present embodiment can reduce the number of communication handshakes between the first terminal and the second terminal on the basis of transmitting all the first files, and reduce the connection overhead. For example, when the first target file is larger than 1M and smaller than 100M, the first terminal is controlled to transmit all contents of the first target file to the second terminal after a successful communication handshake with the second terminal, so that the transmission efficiency is improved, and the transmission time of the folder to be transmitted is shortened.
Specifically, as shown in fig. 5, after the first terminal determines the folder to be transmitted, the file transmission device filters files in the folder to be transmitted, screens out all first files meeting a preset rule, classifies other files except all first files in the folder to be transmitted, obtains a first class of files and a second class of files, further controls the first terminal to combine all the first files, transmits the combined first files to the second terminal after a communication handshake succeeds, controls the first terminal to transmit the first class of files to the second terminal, and also controls the target server to transmit the second class of files to the second terminal, thereby completing the transmission process of the folder to be transmitted.
Correspondingly, for a second terminal, after the second terminal receives the first target file obtained by merging all the first files by the first terminal, splitting the first target file to obtain a plurality of first files, wherein the first files obtained by splitting the second terminal are the same as the first files transmitted in the first terminal.
Therefore, when the folder is transmitted on line, the small files in the folder to be transmitted are firstly screened out, and the small files are combined into a large file and then transmitted, so that the connection overhead can be reduced, and the transmission efficiency is further improved.
EXAMPLE III
Based on the method of the first embodiment, this embodiment further provides another file classification manner, specifically, file feature information of each file in the first class of files is obtained, and a first file whose file feature information meets a preset rule is selected from files included in the first class of files; controlling the first terminal to merge all the first files in the first type of files into a second target file containing at least two first files; the first terminal is further controlled to transmit all the second target files to the second terminal after at most N2 times of successful communication handshake between the first terminal and the second terminal; wherein, the N2 is a positive integer which is greater than or equal to 1 and less than the number of all the first files in the first type of files; and controlling the first terminal to transmit other files except the first file in the first type of files to the second terminal by using the first transmission channel.
That is to say, in this embodiment, as shown in fig. 6, the file transmission device first classifies files in the folder to be transmitted, for example, classifies the files according to the method shown in fig. 2 to obtain a first class of files and a second class of files, and then screens out the first file from the first class of files based on file characteristic information, for example, characteristic information such as file size.
In a specific embodiment, the selecting a first file whose file feature information meets a preset rule from the files included in the first class of files in this embodiment may specifically be:
selecting a first file with the file size smaller than a preset numerical value from files contained in the first type of file; for example, the preset value is 1M, at this time, the selected first file is a small file, and in practical application, when there are many small files in the first type of file transmitted by the first terminal to the second terminal, since the first terminal and the second terminal are required to perform communication handshake for each file transmission, when there are many small files, connection overhead is inevitably increased, and transmission efficiency is reduced. Specifically, the file transmission device controls the first terminal to merge all the first files in the first class of files into a second target file including at least two first files, or merge the first target file into a second target file whose file size is larger than a first value and smaller than or equal to a second value, and further controls the first terminal to transmit all the second target files to the second terminal after at most N2 times of successful communication handshake between the first terminal and the second terminal; wherein, the N2 is a positive integer which is greater than or equal to 1 and less than the number of all the first files in the first type of files; that is to say, in the range of the number of communication handshakes of the number of the first files, the entire content of the second target file is transmitted to the second terminal, so compared with the conventional transmission method in which all the first files are transmitted to the second terminal only when the number of communication handshakes is the same as the number of the first files, the present embodiment can reduce the number of communication handshakes between the first terminal and the second terminal on the basis of transmitting all the first files, and reduce the connection overhead. For example, when the second target file is larger than 1M and smaller than 100M, the first terminal is controlled to transmit all contents of the second target file to the second terminal after a successful communication handshake with the second terminal, so that the transmission efficiency is improved, and the transmission time of the folder to be transmitted is shortened. Meanwhile, the file transmission device may further control the first terminal to transmit the other files in the first class of files to the second terminal by using the first transmission channel, for example, each file in the first class of files except the first file transmitted by the first terminal to the second terminal is transmitted after one successful communication handshake with the second terminal, that is, except for the small file, one successful communication handshake between the first terminal and the second terminal is performed, and only one file can be transmitted.
Specifically, as shown in fig. 7, after the first terminal determines the folder to be transmitted, the file transmission device classifies the folder to be transmitted to obtain a first type of file and a second type of file, then screens files in the first type of file to screen out all first files meeting a preset rule, and controls the first terminal to merge all the first files in the first type of file; and then, controlling the first terminal to transmit the merged first file to the second terminal after one-time communication handshake is successful, controlling the first terminal to transmit the files except the first file in the first type of files to the second terminal, and simultaneously controlling a target server to transmit the second type of files to the second terminal to complete the transmission process of the folder to be transmitted.
Correspondingly, for a second terminal, after the second terminal receives the second target file obtained by merging all the first files by the first terminal, splitting the first target file to obtain a plurality of first files, wherein the first files obtained by splitting the second terminal are the same as the first files transmitted in the first terminal.
Here, it should be noted that in this embodiment, the small files are not screened out before the folder to be transmitted is classified, that is, the small files may exist in the second class of files, but since the second class of files is sent to the second terminal by using the target server, and the target server can send a plurality of files to the second terminal in parallel, with the method described in this embodiment, even if the small files in the second class of files are not merged, the transmission efficiency can be improved.
Certainly, in practical application, in order to further improve the transmission efficiency, the small files in the second type of files may be merged by using the above small file merging manner; specifically, file characteristic information of each file in the second type of files is obtained, and a first file of which the file characteristic information meets a preset rule is selected from the files contained in the second type of files; controlling the target server storing the second type of files to merge all the first files in the second type of files into a third target file containing at least two first files; and then controlling the target server to transmit all the third target files to the second terminal after one-time communication handshake between the target server terminal and the second terminal is successful, and controlling the target server to transmit other files except the first file in the second type of files to the second terminal by using the second transmission channel.
The embodiment of the present invention is further described in detail below with reference to specific application scenarios, where in practical applications, a user usually faces a scenario where a plurality of files are bulky when selecting a transmission folder, and at this time, since a conventional transmission manner is purely online and purely serial, a bottleneck of transmission time usually lies in an upload bandwidth of a sender terminal, and besides, there is no possibility of speed increase.
In order to solve the problems, in the scheme, when the file is transmitted, an offline transmission mode is also utilized besides the online transmission mode. Since offline transmission is an asynchronous process, the purpose of parallel transmission can be achieved by using offline transmission. Further, in the scheme, while offline transmission is utilized, a second transmission mode is also utilized, namely: when the sender terminal transmits the file, if the file is found to exist on the offline file server, the sender terminal directly considers that the uploading is finished, and the receiver terminal can acquire the file through the offline file server. Therefore, the receiving terminal receives the files transmitted on line (such as the files transmitted by the sending terminal) and downloads the offline files (such as the files transmitted by the offline file server) simultaneously in a multithreading mode, so that the receiving speed of the receiving terminal is improved, the file transmission time of the sending terminal and the receiving terminal is shortened, and the user experience is further improved.
Fig. 8 is a schematic flow chart of an implementation process of the file transmission method in a specific application scenario according to the embodiment of the present invention, as shown in fig. 8, the method includes:
step 801: before starting to send the folder, the sender terminal needs to traverse the folder and generate a file list file, wherein the file list file comprises: the names and paths of all files in the folder, and the sizes and unique identifications of all files.
Step 802: the sender terminal sends the transmission message of the folder to the receiver terminal, namely sends the request message of requesting to send the folder to the receiver terminal.
Step 803: the terminal of the receiving party prompts the user on the interface, and after the user selects to receive the folder, the terminal of the receiving party informs the terminal of the sending party to start to transmit the folder.
Step 804: the sender terminal first sends a file list file to the receiver terminal.
Step 805: and after receiving the file list file, the receiver terminal analyzes the file list file, creates a folder according to the file list file, and creates all subfolders if the subfolders exist.
Step 806: and the receiving party terminal traverses all files corresponding to the file list files, screens out small files which can be combined and transmitted according to rules, and generates a small file list, wherein the small file list can represent the paths of the small files in the folder. Here, the rule may be: and screening small files of which the files are smaller than 1M, wherein the combined files are smaller than 100M.
Step 807: and the receiving terminal sends the small file list to the sending terminal.
Step 808: and the sender terminal performs file merging on the small files according to the small file list.
Step 809: at the same time of step 808, the receiving terminal may open a child thread to traverse the large file list.
Here, the large file list is all files in the file list file except for the files in the small file list.
Step 810: and the receiving party terminal sends a query request to the offline file server according to the unique identifier of the file in the large file list.
Step 811: and the offline file server inquires, determines whether the files in the large file list can be downloaded offline, and feeds back an inquiry result of whether offline downloading is supported to the receiving party terminal.
Step 812: and the receiving terminal controls the sub-thread to generate an offline file list according to the query result.
Step 813: and the receiving terminal strips off the offline file list from the large file list to obtain an online file list.
Step 814: and the receiving terminal informs the sub-thread to start downloading the offline files in the offline file list.
Step 815: and the sub-thread downloads the offline files in the offline file list in sequence.
Step 816: and after the sender terminal completes the small file combination, the combined file is sent to the receiver terminal.
Step 817: and after receiving the merged file, the receiver terminal splits the merged file according to the small file list, restores the split small file to the original path, namely restores the small file to the folder, and keeps the position of the small file in the original folder unchanged.
Step 818: and after the files in the small file list are transmitted, the receiving terminal sequentially requests the sending terminal to transmit the files on line according to the on-line file list.
Step 819: and when all the online files in the online file list are completely received, the receiving party terminal informs that the transmission is completed. And the sender terminal informs the user of the completion of the folder transmission.
Step 820: and when the sub-thread finishes downloading all the offline files in the offline file list, informing the receiving party terminal that the downloading of the offline files is finished.
Step 821: and when the files in the online file list and the offline file list are transmitted, informing the user that the file folder is transmitted.
In practical application, the sub-thread in the above steps may be one sub-thread or a plurality of sub-threads, that is, the receiving terminal may download a plurality of offline files through a plurality of sub-threads at the same time.
The transmission flow of the folder is divided into 3 parts, namely small file merging transmission, online file transmission and offline file downloading. The lower part of the off-line file can be executed in parallel with the other 2 parts, and a plurality of files can be downloaded in parallel inside the off-line file. The method effectively utilizes the idle resources in the original flow (for example, when small files are combined, the receiver is in an idle state), and simultaneously improves the utilization efficiency of the receiver resources (the parallel downloading effectively utilizes the bandwidth). The transmission time of the folder can be shortened and the efficiency can be improved no matter the sender and the receiver.
Example four
The present embodiment provides a file transfer apparatus, as shown in fig. 9, the apparatus including:
the file transmission method includes an obtaining unit 91, configured to obtain a folder to be transmitted, which is used for being transmitted from a first terminal to a second terminal, where the folder to be transmitted is a folder that is selected by the first terminal and contains at least two files;
the classification processing unit 92 is configured to perform classification processing on at least two files included in the folder to be transmitted, so as to obtain at least a first type of file and a second type of file, where each type of file includes at least one file;
a control unit 93, configured to correspondingly transmit the first type of file and the second type of file from the first transmission channel and the second transmission channel to the second terminal in parallel by using at least a first transmission channel established between the first terminal and the second terminal and a second transmission channel established between the second terminal and a target server, where the second type of file is stored in the target server.
In a specific embodiment, the classification processing unit 92 is further configured to query whether the target server stores the files included in the folder to be transmitted; and classifying at least two files contained in the folder to be transmitted at least based on the query result.
In another specific embodiment, the obtaining unit 91 is further configured to obtain file feature information of each file included in the file to be transmitted;
the classification processing unit 92 is further configured to select a first file, of which file characteristic information meets a preset rule, from at least two files included in the folder to be transmitted; and classifying other files except the first file in the folder to be transmitted.
In another embodiment, the file characteristic information at least comprises a file size;
the classification processing unit 92 is further configured to select a first file with a file size smaller than a preset numerical value from at least two files included in the folder to be transmitted;
the control unit 93 is further configured to control the first terminal to perform merging processing on all the first files, and merge the first files into a first target file with a file size larger than the preset value; controlling the first terminal to transmit all the first target files to the second terminal after the communication handshake between the first terminal and the second terminal is successful at most N1 times; the N1 is a positive integer which is greater than or equal to 1 and smaller than the number of the first files in the folder to be transmitted.
In another specific embodiment, the obtaining unit 91 is further configured to obtain file feature information of each file in the first class of files;
the classification processing unit 92 is further configured to select a first file, of which file feature information meets a preset rule, from files included in the first class of files;
the control unit 93 is further configured to control the first terminal to perform merging processing on all the first files in the first class of files, and merge the first files into a second target file including at least two first files; controlling the first terminal to transmit all the second target files to the second terminal after at most N2 times of successful communication handshake between the first terminal and the second terminal; wherein, the N2 is a positive integer which is greater than or equal to 1 and less than the number of all the first files in the first type of files; and controlling the first terminal to transmit other files except the first file in the first type of files to the second terminal by using the first transmission channel.
In another specific embodiment, the obtaining unit 91 is further configured to obtain file feature information of each file in the second class of files;
the classification processing unit 92 is further configured to select a first file, of which file feature information meets a preset rule, from files included in the second class of files;
the control unit 93 is further configured to control the target server storing the second type of file to merge all the first files in the second type of file into a third target file including at least two first files; and controlling the target server to transmit all the third target files to the second terminal after one-time communication handshake between the target server terminal and the second terminal is successful, and controlling the target server to transmit other files except the first file in the second type of files to the second terminal by using the second transmission channel.
Here, it should be noted that: the above description of the embodiment of the apparatus is similar to the above description of the embodiment of the method, and has similar beneficial effects to the embodiment of the method, and therefore, the description thereof is omitted. For technical details that are not disclosed in the embodiments of the apparatus of the present invention, please refer to the description of the embodiments of the method of the present invention for understanding, and therefore, for brevity, will not be described again.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described device embodiments are merely illustrative, for example, the division of the unit is only a logical functional division, and there may be other division ways in actual implementation, such as: multiple units or components may be combined, or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the coupling, direct coupling or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection between the devices or units may be electrical, mechanical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed on a plurality of network units; some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, all the functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately regarded as one unit, or two or more units may be integrated into one unit; the integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
Those of ordinary skill in the art will understand that: all or part of the steps for implementing the method embodiments may be implemented by hardware related to program instructions, and the program may be stored in a computer readable storage medium, and when executed, the program performs the steps including the method embodiments; and the aforementioned storage medium includes: a mobile storage device, a Read Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
Alternatively, the integrated unit of the present invention may be stored in a computer-readable storage medium if it is implemented in the form of a software functional module and sold or used as a separate product. Based on such understanding, the technical solutions of the embodiments of the present invention may be essentially implemented or a part contributing to the prior art may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the methods described in the embodiments of the present invention. And the aforementioned storage medium includes: a removable storage device, a ROM, a RAM, a magnetic or optical disk, or various other media that can store program code.
Further, this embodiment also provides a hardware structure of the network device, as shown in fig. 10, the file transmission apparatus includes a transmitter 1001, a receiver 1002, a storage medium 1003, and a processor 1004. The processor 1004 may be a microprocessor, a central processing unit, a digital signal processor, a programmable logic array, or other electronic components with processing functions. The storage medium 1003 stores computer executable codes for executing the file transmission method according to any one of the first to third embodiments. In practical applications, the obtaining unit 91, the classifying unit 92, and the control unit 93 may be implemented by the processor 1004.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (12)

1. A method for file transfer, the method comprising:
acquiring a folder to be transmitted, which is used for being transmitted from a first terminal to a second terminal, wherein the folder to be transmitted is a folder which is selected by the first terminal and contains at least two files;
generating a file list file corresponding to the transmission folder, and transmitting the file list file to a second terminal, wherein the file list file comprises names, paths, sizes and unique identifications of all files in the folder to be transmitted;
inquiring whether an offline server stores files contained in the folder to be transmitted or not based on the file list file, wherein the files in the offline server are uploaded to the offline server by the first terminal when the second terminal is not in an online state;
classifying at least two files contained in the folder to be transmitted at least based on the query result to obtain a first type of file which is not stored in the offline server and a second type of file which is stored in the offline server;
and correspondingly transmitting the first type of files and the second type of files from the first transmission channel and the second transmission channel to the second terminal in parallel by at least utilizing the first transmission channel established by the first terminal and the second transmission channel established by the second terminal and the offline server.
2. The method according to claim 1, wherein the classifying the at least two files contained in the folder to be transmitted comprises:
acquiring file characteristic information of each file contained in the file to be transmitted, and selecting a first file of which the file characteristic information meets a preset rule from at least two files contained in the folder to be transmitted;
and classifying other files except the first file in the folder to be transmitted.
3. The method according to claim 2, wherein the file characteristic information includes at least a file size; the selecting of the first file with file characteristic information meeting a preset rule from the at least two files contained in the folder to be transmitted includes:
selecting a first file with the file size smaller than a preset numerical value from at least two files contained in the folder to be transmitted;
the method further comprises the following steps:
controlling the first terminal to merge all the first files into a first target file with the file size larger than the preset value;
controlling the first terminal to transmit all the first target files to the second terminal after N1 times of successful communication handshake between the first terminal and the second terminal at most; the N1 is a positive integer which is greater than or equal to 1 and smaller than the number of the first files in the folder to be transmitted.
4. The method of claim 1, further comprising:
acquiring file characteristic information of each file in the first type of files, and selecting a first file of which the file characteristic information meets a preset rule from the files contained in the first type of files;
the step of transmitting the first type of file from the first transmission channel to the second terminal comprises:
controlling the first terminal to merge all the first files in the first type of files into a second target file containing at least two first files;
controlling the first terminal to transmit all the second target files to the second terminal after at most N2 times of successful communication handshake between the first terminal and the second terminal; wherein, the N2 is a positive integer which is greater than or equal to 1 and less than the number of all the first files in the first type of files; and controlling the first terminal to transmit other files except the first file in the first type of files to the second terminal by using the first transmission channel.
5. The method according to claim 1 or 3, characterized in that the method further comprises:
acquiring file characteristic information of each file in the second type of files, and selecting a first file of which the file characteristic information meets a preset rule from the files contained in the second type of files;
the step of transmitting the second type of file from the second transmission channel to the second terminal comprises:
controlling an offline server in which the second type of files are stored to merge all the first files in the second type of files into a third target file containing at least two first files;
and controlling the offline server to transmit all the third target files to the second terminal after the communication handshake between the offline server and the second terminal is successful, and controlling the offline server to transmit other files except the first file in the second type of files to the second terminal by using the second transmission channel.
6. A file transfer apparatus, characterized in that the apparatus comprises:
the file transmission method comprises the steps that an obtaining unit is used for obtaining a folder to be transmitted, wherein the folder to be transmitted is used for being transmitted from a first terminal to a second terminal, and the folder to be transmitted is a folder which is selected by the first terminal and contains at least two files; generating a file list file corresponding to the transmission folder, and transmitting the file list file to a second terminal, wherein the file list file comprises names, paths, sizes and unique identifications of all files in the folder to be transmitted;
the classification processing unit is used for inquiring whether an offline server stores the files contained in the folder to be transmitted or not based on the file list file, and the first terminal uploads the files to the offline server when the second terminal is not in an online state;
classifying at least two files contained in the folder to be transmitted at least based on the query result to obtain a first type of file which is not stored in the offline server and a second type of file which is stored in the offline server;
and the control unit is used for correspondingly transmitting the first type of files and the second type of files from the first transmission channel and the second transmission channel to the second terminal in parallel by utilizing at least the first transmission channel established by the first terminal and the second transmission channel established by the second terminal and the offline server.
7. The apparatus according to claim 6, wherein the obtaining unit is further configured to obtain file feature information of each of the files to be transmitted;
the classification processing unit is further used for selecting a first file of which the file characteristic information meets a preset rule from at least two files contained in the folder to be transmitted; and classifying other files except the first file in the folder to be transmitted.
8. The apparatus according to claim 7, wherein the file characteristic information comprises at least a file size;
the classification processing unit is further used for selecting a first file with a file size smaller than a preset numerical value from at least two files contained in the folder to be transmitted;
the control unit is further configured to control the first terminal to perform merging processing on all first files, and merge the first files into a first target file with a file size larger than the preset value; controlling the first terminal to transmit all the first target files to the second terminal after the communication handshake between the first terminal and the second terminal is successful at most N1 times; the N1 is a positive integer which is greater than or equal to 1 and smaller than the number of the first files in the folder to be transmitted.
9. The apparatus according to claim 6, wherein the obtaining unit is further configured to obtain file feature information of each file in the first class of files;
the classification processing unit is further configured to select a first file, of which file feature information meets a preset rule, from files included in the first class of files;
the control unit is further configured to control the first terminal to perform merging processing on all the first files in the first class of files, and merge the first files into a second target file including at least two first files; controlling the first terminal to transmit all the second target files to the second terminal after at most N2 times of successful communication handshake between the first terminal and the second terminal; wherein, the N2 is a positive integer which is greater than or equal to 1 and less than the number of all the first files in the first type of files; and controlling the first terminal to transmit other files except the first file in the first type of files to the second terminal by using the first transmission channel.
10. The apparatus according to claim 6 or 8, wherein the obtaining unit is further configured to obtain file characteristic information of each file in the second class of files;
the classification processing unit is further configured to select a first file, of which file feature information meets a preset rule, from files included in the second class of files;
the control unit is further configured to control the offline server storing the second type of file to merge all the first files in the second type of file into a third target file including at least two first files; and controlling the offline server to transmit all the third target files to the second terminal after one-time communication handshake between the offline server terminal and the second terminal is successful, and controlling the offline server to transmit other files except the first file in the second type of files to the second terminal by using the second transmission channel.
11. A computer device, comprising:
a memory for storing executable instructions;
a processor, configured to execute the executable instructions stored in the memory, and to implement the file transfer method according to any one of claims 1 to 5.
12. A computer-readable storage medium having stored thereon executable instructions for causing a processor to perform the file transfer method of any one of claims 1 to 5 when executed.
CN201710590282.9A 2017-07-19 2017-07-19 File transmission method and device Active CN109286641B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710590282.9A CN109286641B (en) 2017-07-19 2017-07-19 File transmission method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710590282.9A CN109286641B (en) 2017-07-19 2017-07-19 File transmission method and device

Publications (2)

Publication Number Publication Date
CN109286641A CN109286641A (en) 2019-01-29
CN109286641B true CN109286641B (en) 2022-03-11

Family

ID=65184458

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710590282.9A Active CN109286641B (en) 2017-07-19 2017-07-19 File transmission method and device

Country Status (1)

Country Link
CN (1) CN109286641B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110287159B (en) * 2019-06-03 2021-11-12 北京一览群智数据科技有限责任公司 File processing method and device
CN111953623A (en) * 2020-07-31 2020-11-17 深圳市泛海检测认证有限公司 Data transmission method and system
CN112039969B (en) * 2020-08-26 2022-04-08 浪潮云信息技术股份公司 AWS 3 URL uploading method based on Redis distributed lock development
CN113934553A (en) * 2021-10-14 2022-01-14 西安万像电子科技有限公司 Shear plate redirection transmission method and device, storage medium and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102137031A (en) * 2010-01-21 2011-07-27 腾讯科技(深圳)有限公司 Method and equipment for transmitting folders
CN102685159A (en) * 2011-03-10 2012-09-19 腾讯科技(深圳)有限公司 File transmission method and device
CN103516584A (en) * 2012-06-28 2014-01-15 北京奇虎科技有限公司 Method and device for transmitting file in instant messaging
CN105208065A (en) * 2014-06-24 2015-12-30 腾讯科技(深圳)有限公司 File transmitting method and device
CN106161633A (en) * 2016-07-20 2016-11-23 柏科数据技术(深圳)股份有限公司 A kind of based on the transmission method of packaging file under cloud computing environment and system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102651716A (en) * 2011-02-24 2012-08-29 阿里巴巴集团控股有限公司 Method and system for file folder transmission in instant communication, and instant receiving client side

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102137031A (en) * 2010-01-21 2011-07-27 腾讯科技(深圳)有限公司 Method and equipment for transmitting folders
CN102685159A (en) * 2011-03-10 2012-09-19 腾讯科技(深圳)有限公司 File transmission method and device
CN103516584A (en) * 2012-06-28 2014-01-15 北京奇虎科技有限公司 Method and device for transmitting file in instant messaging
CN105208065A (en) * 2014-06-24 2015-12-30 腾讯科技(深圳)有限公司 File transmitting method and device
CN106161633A (en) * 2016-07-20 2016-11-23 柏科数据技术(深圳)股份有限公司 A kind of based on the transmission method of packaging file under cloud computing environment and system

Also Published As

Publication number Publication date
CN109286641A (en) 2019-01-29

Similar Documents

Publication Publication Date Title
CN109286641B (en) File transmission method and device
JP6199379B2 (en) System and method for persistent wireless docking
KR101145789B1 (en) Method and system for content categorization
CN111163130B (en) Network service system and data transmission method thereof
CN110247951B (en) File transmission control method, device, equipment and storage medium
US20200389501A1 (en) Methods and user equipment for exchanging service capabilities
CN103873692A (en) Method, device and system for resource sharing
US20200019535A1 (en) Method and system for preparing data files for transmission over a data network
EP3734927A1 (en) Content service implementation method and device, and content delivery network node
CN109510754B (en) Online document generation method, device and system and electronic equipment
CN112751897B (en) Load balancing method, device, medium and equipment
US20210360476A1 (en) Method for downloading data and terminal device
CN103220822A (en) Data transmission method, data transmission device and mobile terminal
JP6487416B2 (en) Method and apparatus for dynamic content offloading
CN107431700B (en) Method and apparatus for indication of partial segments
CN102739717A (en) Downloading method, downloading proxy server and network system
CN104394208A (en) File transmission method and server
CN117596232A (en) Method, device and system for fast starting streaming media
CN110719526B (en) Video playing method and device
CN111338780B (en) Transmission method and device for concurrent files
CN104811485A (en) Resource sharing method
CN104639985A (en) Multimedia playing control method and system
CN112243038B (en) Downloading method, terminal and computer storage medium
US9374559B1 (en) Low-latency media sharing
EP3089426A1 (en) Data download method and device

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