CN115118712A - File transmission method and device - Google Patents

File transmission method and device Download PDF

Info

Publication number
CN115118712A
CN115118712A CN202210635019.8A CN202210635019A CN115118712A CN 115118712 A CN115118712 A CN 115118712A CN 202210635019 A CN202210635019 A CN 202210635019A CN 115118712 A CN115118712 A CN 115118712A
Authority
CN
China
Prior art keywords
file
target
file source
source
direct connection
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210635019.8A
Other languages
Chinese (zh)
Inventor
焦梦洪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ant Blockchain Technology Shanghai Co Ltd
Original Assignee
Ant Blockchain Technology Shanghai 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 Ant Blockchain Technology Shanghai Co Ltd filed Critical Ant Blockchain Technology Shanghai Co Ltd
Priority to CN202210635019.8A priority Critical patent/CN115118712A/en
Publication of CN115118712A publication Critical patent/CN115118712A/en
Pending legal-status Critical Current

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/14Session management
    • H04L67/141Setup of application sessions

Landscapes

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

Abstract

The specification discloses a method and a device for file transmission, wherein a target device can determine a target file and determine a file source address of each file source capable of providing the target file, a direct connection request for establishing a direct connection channel between the target device and each file source is sent to a node device in a block chain transmission network so as to establish the direct connection channel with at least part of the file sources through the node device, the file source establishing the direct connection channel with the target device is used as the target file source, and a data acquisition request is sent to the target file source so as to enable the target file source to return file blocks in the target file required by the target device to the target device, when the target device needs to acquire the target file, the method can directly acquire the file blocks from the file sources which are successfully connected, and the target device can acquire a plurality of file blocks through a plurality of file sources simultaneously, therefore, the method can improve the efficiency of the target device in acquiring the target file.

Description

File transmission method and device
Technical Field
The present disclosure relates to the field of data transmission, and in particular, to a method and an apparatus for file transmission.
Background
With the advent of the internet era, it is common for various fields to cooperate with service execution through server devices, and among them, data transmission is often an indispensable link.
In order to improve the data processing efficiency in the block chain service, a Network specially used for processing the block chain service, that is, a block chain Transmission Network (BTN), is currently constructed, however, when the BTN is used for large file Transmission, much time is often consumed, and the efficiency is low.
Therefore, it is an urgent problem to improve the efficiency of transmitting large files.
Disclosure of Invention
The present specification provides a method and an apparatus for file transmission, so as to improve efficiency of large file transmission between devices.
The technical scheme adopted by the specification is as follows:
the present specification provides a method for file transfer, including:
the target equipment determines a target file;
determining a file source address of each file source capable of providing the target file, wherein the file source comprises: a device that has downloaded the target file, and/or a device that is currently downloading the target file;
according to the file source address of each file source, sending a direct connection request for establishing a direct connection channel between the target device and each file source to node devices in a block chain transmission network (BTN), so as to establish the direct connection channel between the target device and at least part of the file sources through the node devices;
and taking a file source which establishes a direct connection channel with the target equipment as a target file source, and sending a data acquisition request to the target file source so that the target file source returns file blocks in a target file required by the target equipment to the target equipment.
Optionally, sending, to a node device, a direct connection request for establishing a direct connection channel between the target device and each file source according to the file source address, where the direct connection request includes:
sending a direct connection request for establishing a direct connection channel between the target device and each file source to node devices according to the file source address of each file source, so that the node devices analyze and obtain port information of each file source and port information of the target device according to the direct connection request, forward the port information of each file source to the target devices, and forward the port information of the target devices to each file source;
and the target equipment establishes a direct connection channel with each file source according to the port information of each file source.
Optionally, the method further comprises:
for each file source, if a direct connection channel is not established between the target device and the file source, the target device sends a data acquisition request corresponding to the file source to the node device so as to acquire the file blocks of the target file.
Optionally, before the target device receives each file source identifier, the method further includes:
sending a file downloading request to the node equipment so that the node equipment forwards the file downloading request to the equipment in which the target file is stored;
and receiving the returned file metadata, and analyzing to obtain the source address of each file according to the file metadata.
Optionally, the method further comprises:
writing the received file blocks into a temporary file;
and after all the file blocks are received, all the file blocks are transferred to the corresponding storage addresses of the target file for storage.
The present specification provides a method for file transfer, including:
a node device in a block chain transmission network (BTN) receives a direct connection request sent by a target device and used for establishing a direct connection channel with each file source capable of providing a target file, wherein the file source comprises: the device which downloads the target file and/or the device which is downloading the target file currently, wherein the direct connection request is sent to the node device by the target device based on the file source address of each file source;
according to the direct connection request, establishing a direct connection channel between the target device and each file source, enabling the target device to use the file source which establishes the direct connection channel with the target device as a target file source, sending a data acquisition request to the target file source, and enabling the target file source to return file blocks of the target file required by the target device to the target device.
Optionally, the method further comprises:
receiving a data acquisition request sent by the target equipment, and judging whether file blocks required by the data acquisition request are stored locally or not according to the data acquisition request;
and if the file source corresponding to the data acquisition request is not the target device, the data acquisition request is continuously forwarded to the file source corresponding to the data acquisition request.
Optionally, establishing a direct connection channel between the target device and each file source according to the direct connection request includes:
and analyzing to obtain the port information of each file source and the port information of the target equipment according to the direct connection request, forwarding the port information of each file source to the target equipment, and forwarding the port information of the target equipment to each file source, so that the target equipment establishes a direct connection channel with each file source according to the port information of each file source.
In this specification, there is provided an apparatus for file transfer, including:
a file determination module for the device to determine a target file;
an address determining module, configured to determine a file source address of each file source capable of providing the target file, where the file source includes: a device that has downloaded the target file, and/or a device that is currently downloading the target file;
a direct connection request module, configured to send, to a node device in a block chain transport network BTN, a direct connection request for establishing a direct connection channel between the apparatus and each file source according to the file source identifier, so that the node device forwards, to each file source, a direct connection request corresponding to the file source;
and the data request module is used for taking a file source which establishes a direct connection channel with the device as a target file source and sending a data acquisition request to the target file source so as to enable the target file source to return the file blocks in the target file to the device.
Optionally, the apparatus further comprises:
and the indirect acquisition module is used for sending a data acquisition request corresponding to the file source to the node equipment by the device to acquire the file blocks of the target file if a direct connection channel is not established between the device and the file source for each file source.
This specification provides a file transfer apparatus, including:
a receiving module, configured to receive, by the apparatus, a direct connection request sent by a target device and used for establishing a direct connection channel with each file source capable of providing a target file, where the file source includes: the device already downloading the target file and/or the device currently downloading the target file, wherein the direct connection request is sent to the device by the target device based on the file source address of each file source, and the device is a node device in a block chain transmission network (BTN);
and the constructing module is used for establishing a direct connection channel between the target equipment and each file source according to the direct connection request, so that the target equipment takes the file source establishing the direct connection channel with the target equipment as a target file source, sends a data acquisition request to the target file source and returns the file blocks of the target file to the target equipment by the target file source.
Optionally, the apparatus further comprises:
the query module is used for receiving a data acquisition request sent by the target equipment and judging whether file blocks required by the data acquisition request are stored locally or not according to the data acquisition request; and if the file source corresponding to the data acquisition request is not the target device, the data acquisition request is continuously forwarded to the file source corresponding to the data acquisition request.
Optionally, the building module is configured to, according to the direct connection request, analyze the port information of each file source and the port information of the target device to obtain, forward the port information of each file source to the target device, and forward the port information of the target device to each file source, so that the target device establishes a direct connection channel with each file source according to the port information of each file source.
The present specification provides a computer-readable storage medium storing a computer program which, when executed by a processor, implements the above-described method of file transfer.
The present specification provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the file transfer method when executing the program.
The technical scheme adopted by the specification can achieve the following beneficial effects:
as can be seen from the above method for file transmission, a target device may determine a target file, determine file source addresses of file sources that can provide the target file, send a direct connection request for establishing direct connection channels between the target device and the file sources to a node device in a block chain transmission network according to the file source addresses, establish the direct connection channels with at least part of the file sources through the node device, use the file sources that establish the direct connection channels with the target device as the target file sources, and send a data acquisition request to the target file sources, so that the target file sources return file chunks in the target file that are needed by the target device to the target device.
As can be seen from the above, when the target device needs to acquire the target file, the method may request direct connection from each file source storing the target file through the node device, and directly acquire the file blocks from the file source where the direct connection is successful, and the target device may acquire a plurality of file blocks through a plurality of file sources at the same time, so that after the file blocks are acquired in parallel, the file blocks may be combined into the target file, and thus, the method may improve the efficiency of the target device acquiring the target file.
Drawings
The accompanying drawings, which are included to provide a further understanding of the specification and are incorporated in and constitute a part of this specification, illustrate embodiments of the specification and together with the description serve to explain the specification and not to limit the specification in a non-limiting sense. In the drawings:
FIG. 1 is a schematic flow chart of a method for file transfer according to the present disclosure;
FIG. 2 is a schematic flow chart of a method for file transfer according to the present disclosure;
fig. 3 is a flowchart illustrating a target device acquiring a target file through file sources according to the present disclosure;
FIG. 4 is a schematic diagram of a document transmission apparatus provided herein;
FIG. 5 is a schematic diagram of a document transmission apparatus provided herein;
fig. 6 is a schematic diagram of an electronic device corresponding to fig. 1 or fig. 2 provided in the present specification.
Detailed Description
In order to make the objects, technical solutions and advantages of the present disclosure more clear, the technical solutions of the present disclosure will be clearly and completely described below with reference to the specific embodiments of the present disclosure and the accompanying drawings. It is to be understood that the embodiments described are only a few embodiments of the present disclosure, and not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present specification without any creative effort belong to the protection scope of the present specification.
The technical solutions provided by the embodiments of the present description are described in detail below with reference to the accompanying drawings.
Fig. 1 is a schematic flow diagram of a file transmission method in this specification, which specifically includes the following steps:
s100: the target device determines a target file.
S102: determining a file source address of each file source capable of providing the target file, wherein the file source comprises: a device that has downloaded the target file, and/or a device that is currently downloading the target file.
In practical application, there is often a need to transmit a large file, and the efficiency is low when the large file is directly transmitted between devices, so that the file transmission method provided in the specification can improve the transmission efficiency in the process of transmitting the large file in some ways.
Based on this, the target device may determine the target file and determine the file source address of each file source capable of providing the target file, wherein each file source mentioned herein may include a device currently downloading the target file required by the target device and/or a device downloading the target file. The target device and the specific form of the device mentioned herein are not limited, for example, the target device (or the device) may be a server, a computer, or the like.
Then, the target device may send a direct connection request for establishing a direct connection channel between the target device and each file source to a node device in a block chain Transmission Network (BTN) according to a file source address of each file source, so that the node device forwards the direct connection request corresponding to the file source to each file source.
That is to say, in the foregoing description, the target device needs the target file, and the file source corresponding to each file source identifier may store the target file, in order to improve efficiency of acquiring the target file by the target device, the target device may first attempt to request direct connection with each file source through the node device, and if the target device can directly connect with the file source, efficiency of data transmission between the target device and the file source can be improved.
It should be noted that each of the above-mentioned file source addresses may be a file source address that is actively sent to the target device by the node device or any one of the file sources, or may be a file source address that is actively requested by the target device from the node device or any one of the file sources.
The target device may send a file download request to the node device, so that the node device forwards the file download request to the device in which the target file is stored, and then the target device may receive the returned file metadata and obtain each file source identifier by parsing according to the file metadata.
The file metadata mentioned herein may refer to information related to the target file, and may be used to describe the target file, for example, the file metadata may include a file source address of each file source storing the target file, a file size of the target file, a file digest, a digest of each file block of the file, a unique tag of the file, and the like. The file source address mentioned herein may refer to a MAC address of the file source, an IP address of the file source, and the like, and the file source address may be used to identify the file source.
It should be further noted that, in order to further improve the efficiency of file transmission, in this specification, the target device may first determine whether the file size of the target file exceeds a set size, and if the file size exceeds the set size, then send the file download request to the node device in the blockchain transmission network, because the file transmission rate of the blockchain transmission network is fast, if the file size is large, the target file may be obtained through (the node device in) the blockchain transmission network, and if the file size is not large, the target file may be obtained through other devices.
S104: and sending a direct connection request for establishing a direct connection channel between the target device and each file source to node devices in a block chain transmission network (BTN) according to the file source identification, so as to establish the direct connection channel between the target device and at least part of the file sources through the node devices.
S106: and taking a file source which establishes a direct connection channel with the target equipment as a target file source, and sending a data acquisition request to the target file source so as to enable the target file source to return file blocks in the target file to the target equipment.
After receiving the file source addresses, the target device may send, to the node device in the BTN, a direct connection request for establishing a direct connection channel between the target device and each file source according to the file source addresses, so as to establish the direct connection channel between the node device and at least part of the file sources. The way for the target device to establish a direct connection channel with the file source may be a way for P2P to make a hole.
When the direct connection channel is established, the target device can send a direct connection request for establishing the direct connection channel between the target device and each file source to the node device according to each file source identifier, so that the node device can analyze port information of each file source and port information of the target device according to the direct connection request, forward the port information of each file source to the target device, and forward the port information of the target device to each file source, and then the target device can establish the direct connection channel between the target device and each file source according to the port information of each file source.
Specifically, after the target device sends the direct connection request to the node device, the node device may continuously forward the network request between the target device and each file source (where the network request forwarded by the node device to each file source may be the direct connection request sent by the target device to the node device, or may be any other network request), so as to obtain the port information of each file source and the port information of the target device through analysis. The port information of each file source and the port information of the target device mentioned herein may be used for direct communication between the target device and each file source, where the port information may include a network port number, IP information, and the like of the device.
Then, the target device may use a file source that establishes a direct connection channel with the target device as a target file source, and send a data acquisition request to the target file source, so that the target file source returns file chunks in the target file to the target device. That is to say, if direct connection is not performed, when the target device obtains the target file through the file source, the target device needs to indirectly obtain the target file through the file source through the node device, and if a direct connection channel is established between the target device and the file source, the target device can directly communicate with the file source through the direct connection channel, so that the communication efficiency between the target device and the file source is improved.
However, it is possible that in the previous steps, the direct channel between the target device and some of the file sources fails to be established, and at this time, the target device may also communicate with such file sources indirectly through the node device to obtain the required data. Specifically, for each file source, if a direct connection channel is not established between the target device and the file source, the target device may send a data acquisition request corresponding to the file source to the node device, so as to acquire the file partition of the target file.
That is to say, for the target device, each file source may be divided into a file source in which the direct connection channel is successfully established and a file source in which the direct connection channel is not established, and both file sources may make a data request, so that the required data may be simultaneously acquired from both file sources to acquire the target file. In addition, the target device can acquire the target file from a plurality of file sources at one time, so that the target file can be divided into a plurality of file blocks, the target device can acquire a plurality of file blocks from each file source, and after all the file blocks are finally acquired, the file blocks can be combined into the target file.
For example, assuming that a direct channel is established between the file source A, B and the target device, but a direct channel is not established between the file source C, D and the target device, the target device may request the file source A, B directly for file chunks retrieved from the file source A, B; and indirectly obtain the file chunks that need to be obtained from file source C, D through the node device.
It should be noted that, for the way of indirectly obtaining the file blocks from the file source through the node device, because the node device may sometimes be used as an intermediate device for data transmission, data that needs to be transferred may be stored in a local disk or a memory of the node device, and if the file blocks needed by the target device are stored in the node device, the node device may directly return the file blocks to the target device, and it is not necessary to continuously forward the data obtaining request to the corresponding file source.
That is, after receiving a data acquisition request sent by a target device, a node device may first determine, according to the data acquisition request, whether file chunks required by the data acquisition request are stored locally, if so, may return the file chunks required by the data acquisition request to the target device, and if not, may continue to forward the data acquisition request to a file source corresponding to the data acquisition request.
The above description is directed to the method for transferring a file by using a target device as an execution subject, but the node device is indispensable in the method, and therefore, the method for transferring a file by using the node device as the execution subject will be described below.
Fig. 2 is a schematic flow chart of a file transmission method in this specification, which specifically includes the following steps:
s200: a node device in a block chain transmission network (BTN) receives a direct connection request sent by a target device and used for establishing a direct connection channel with each file source capable of providing a target file, wherein the file source comprises: the device already downloading the target file and/or the device currently downloading the target file, wherein the direct connection request is sent by the target device to the node device based on the file source address of each file source.
S202: according to the direct connection request, establishing a direct connection channel between the target device and each file source, enabling the target device to use the file source which establishes the direct connection channel with the target device as a target file source, sending a data acquisition request to the target file source, and enabling the target file source to return file blocks of the target file required by the target device to the target device.
After a target device sends a direct connection request for establishing direct connection channels between the target device and each file source to a node device in the BTN, the node device may establish the direct connection channels between the target device and each file source, that is, the target device may establish the direct connection channels between at least some of the file sources and the target device. The direct connection request may carry a file source address, so that the node device may determine which file sources the target device needs to establish direct connection with.
And then, the target device can take the file source successfully establishing the straight communication channel in each file source as the target file source, so as to directly acquire the file blocks required to be acquired from the target file source.
Since the functions of the node devices have been described together in the description taking the target device as the execution subject, the description is not repeated here, and a complete example will be used to describe the file transfer method in this specification, as shown in fig. 3.
Fig. 3 is a flowchart illustrating a target device acquiring a target file through file sources according to this specification.
As can be seen from fig. 3, a target device needs to send a file download request to a node device, where the file download request may carry a file identifier of a target file required by the target device, so that the node device forwards the file download request to a device in which the target file is stored, the device may read file metadata of the target file stored locally according to the file identifier and return the file metadata to the target device, where the file metadata may include a file source address of each file source, and the target device may determine, according to the file source address of each file source, each file source used for acquiring the target file, and send a direct connection request for directly connecting to each file source to the node device.
Therefore, the node device can establish a direct connection channel between each file source and the target device for the target device and each file source, for one file source, if the target device is successfully and directly connected with the file source, the node device can directly send a data acquisition request to the file source to acquire the file blocks required at the file source, and if the target device is not successfully and directly connected with the file source, the node device needs to send the data acquisition request to the node device first, queries whether the file blocks are stored locally, and if the file blocks are not stored, the node device needs to continuously request the file blocks from the file source. In addition, the target device may also concurrently obtain different file chunks from multiple file sources at once.
The file source can perform indexing according to the file name of the target file, the file abstract of the target file and the block identification of the file block, and store the file block locally for a certain time. Therefore, the data acquisition request sent by the target device may carry the block identifier of the required file block, the file name of the target file, and the file abstract of the target file, so that the node device may first query whether the file block is stored locally according to the data carried in the data acquisition request, and then perform the subsequent steps, and of course, the file source may also store the file block in this way.
It should be noted that, after receiving a certain file block, the target device may store the file block in the temporary file first, until all file blocks of the target file are received, perform file integrity check on each file block to determine whether the target file is completely received, and after passing the integrity check, may transfer each file block in the temporary file to a storage address of the target file to store, and delete the temporary file, specifically, may perform integrity check by using a file digest of the target file, where the file digest may refer to an md5 value of the target file.
The file metadata may further include digest information corresponding to each file partition (of course, the digest information of the file partition may also be obtained from the target device to the file source), and when receiving a part of the file partitions, the target device may perform file partition level verification on the file partitions first, and if the file partitions are not verified, the file partitions that have not been verified may be obtained again.
Since it takes too much time to perform integrity check on all file chunks, the target device may perform check only on a part of the file chunks when receiving the part of the file chunks.
Specifically, the target device may verify a set number of file chunks when receiving the set number of file chunks, for example, the target device may record the block identifier corresponding to each file block when receiving each file block, and send the block identifiers of the set number of file blocks to the file source (which may be any file source, or a file source that sends the file blocks, and if a direct connection channel is established between the file source and the file source, the file source may directly send the file blocks, and if the file source is not established, the file source needs to send the file blocks through the node device), so that the file source returns the summary information of the file blocks to check the file blocks, receives the set number of file blocks, continues to check the set number of file blocks, and, after all the file blocks are received, the integrity of the file formed by all the file blocks can be checked.
According to the method, when the target device needs to acquire the target file, direct connection can be requested to each file source storing the target file through the node device, the file blocks can be directly acquired from the file source which is successfully connected, and for the file sources which are not successfully connected, the file blocks can be acquired indirectly through the node device.
The file transmission method provided above for one or more embodiments of the present specification also provides a file transmission apparatus based on the same idea, as shown in fig. 4 and fig. 5.
Fig. 4 is a schematic diagram of a file transfer apparatus provided in this specification, which specifically includes:
a file determining module 401, configured to determine a target file by the apparatus;
an address determining module 402, configured to determine a file source address of each file source capable of providing the target file, where the file source includes: a device that has downloaded the target file, and/or a device that is currently downloading the target file;
a direct connection request module 403, configured to send, according to the file source address of each file source, a direct connection request for establishing a direct connection channel between the apparatus and each file source to a node device in a block chain transport network BTN, so that the node device forwards, to each file source, a direct connection request corresponding to the file source;
a data request module 404, configured to use a file source that establishes a direct connection channel with the device as a target file source, and send a data acquisition request to the target file source, so that the target file source returns a file chunk in the target file to the device.
Optionally, the direct connection request module 403 is configured to send, to a node device, a direct connection request for establishing a direct connection channel between the device and each file source according to a file source address of each file source, so that the node device obtains, according to the direct connection request, port information of each file source and port information of the target device through parsing, forwards the port information of each file source to the device, and forwards the port information of the device to each file source; and the target equipment establishes a direct connection channel with each file source according to the port information of each file source.
Optionally, the apparatus further comprises:
an indirect obtaining module 405, configured to send, for each file source, a data obtaining request corresponding to the file source to the node device if a direct connection channel is not established between the target device and the file source, so as to obtain a file partition of the target file.
Optionally, the apparatus further comprises:
a request downloading module 406, configured to send a file downloading request to the node device, so that the node device forwards the file downloading request to a device in which the target file is stored; and receiving returned file metadata, and analyzing to obtain the source identification of each file according to the file metadata.
Optionally, the apparatus further comprises:
the transfer module 407, which writes the received file blocks into the temporary file; and after all the file blocks are received, all the file blocks are transferred to the corresponding storage addresses of the target file for storage.
Fig. 5 is a schematic diagram of a file transfer apparatus provided in this specification, which specifically includes:
a receiving module 501, configured to receive a direct connection request sent by a target device and used for establishing a direct connection channel with each file source capable of providing a target file, where the file source includes: the device already downloading the target file and/or the device currently downloading the target file, wherein the direct connection request is sent to the device by the target device based on the file source address of each file source, and the device is a node device in a block chain transport network (BTN);
a building module 502, configured to build a direct connection channel between the target device and each file source according to the direct connection request, so that the target device uses a file source that builds the direct connection channel with the target device as a target file source, sends a data acquisition request to the target file source, and returns a file partition of the target file to the target device by the target file source.
Optionally, the apparatus further comprises:
the query module 503 is configured to receive a data acquisition request sent by the target device, and determine whether a file block required by the data acquisition request is stored locally according to the data acquisition request; and if the file is the block required by the data acquisition request, returning the file block required by the data acquisition request to the target equipment, and if the file is not the block required by the data acquisition request, continuously forwarding the data acquisition request to a file source corresponding to the data acquisition request.
Optionally, the constructing module 502 is configured to, according to the direct connection request, analyze the port number of each file source and the port information of the target device to obtain, forward the port information of each file source to the target device, and forward the port number of the target device to each file source, so that the target device establishes a direct connection channel with each file source according to the port information of each file source.
The present specification also provides a computer-readable storage medium storing a computer program, which is operable to execute the above-described file transfer method.
This specification also provides a schematic block diagram of the electronic device shown in fig. 6. As shown in fig. 6, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, but may also include hardware required for other services. The processor reads the corresponding computer program from the nonvolatile memory to the memory and then runs the computer program to realize the file transmission method. Of course, besides the software implementation, the present specification does not exclude other implementations, such as logic devices or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, and may be hardware or logic devices.
In the 90's of the 20 th century, improvements to a technology could clearly distinguish between improvements in hardware (e.g., improvements to circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements to process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain a corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical modules. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Furthermore, nowadays, instead of manually making an Integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as abel (advanced Boolean Expression Language), ahdl (alternate Hardware Description Language), traffic, pl (core universal Programming Language), HDCal (jhdware Description Language), lang, Lola, HDL, laspam, hardward Description Language (vhr Description Language), vhal (Hardware Description Language), and vhigh-Language, which are currently used in most common. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: the ARC625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be considered a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be conceived to be both a software module implementing the method and a structure within a hardware component.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functions of the various elements may be implemented in the same one or more software and/or hardware implementations of the present description.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
This description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only an example of the present specification, and is not intended to limit the present specification. Various modifications and alterations to this description will become apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification should be included in the scope of the claims of the present specification.

Claims (15)

1. A method for file transmission, which is applied to a target device, comprises the following steps:
the target equipment determines a target file;
determining a file source address of each file source capable of providing the target file, wherein the file source comprises: a device that has downloaded the target file, and/or a device that is currently downloading the target file;
according to the file source address of each file source, sending a direct connection request for establishing a direct connection channel between the target device and each file source to node devices in a block chain transmission network (BTN), so as to establish the direct connection channel between at least part of file sources through the node devices;
and taking a file source which establishes a direct connection channel with the target equipment as a target file source, and sending a data acquisition request to the target file source so as to enable the target file source to return the file blocks in the target file to the target equipment.
2. The method of claim 1, wherein sending, to a node device, a direct connection request for establishing a direct connection channel between the target device and each file source according to the file source address of each file source comprises:
sending a direct connection request for establishing a direct connection channel between the target device and each file source to node devices according to the file source address of each file source, so that the node devices analyze and obtain port information of each file source and port information of the target device according to the direct connection request, forward the port information of each file source to the target devices, and forward the port information of the target devices to each file source;
and the target equipment establishes a direct connection channel with each file source according to the port information of each file source.
3. The method of claim 1, further comprising:
for each file source, if a direct connection channel is not established between the target device and the file source, the target device sends a data acquisition request corresponding to the file source to the node device to acquire the file blocks of the target file.
4. The method of claim 1, wherein before the target device receives the file source identifiers, further comprising:
sending a file downloading request to the node equipment so that the node equipment forwards the file downloading request to the equipment in which the target file is stored;
and receiving the returned file metadata, and analyzing to obtain the source address of each file according to the file metadata.
5. The method of claim 1, further comprising:
writing the received file blocks into a temporary file;
and after all the file blocks are received, all the file blocks are transferred to the corresponding storage addresses of the target file for storage.
6. A method of file transfer, comprising:
a node device in a block chain transmission network (BTN) receives a direct connection request sent by a target device and used for establishing a direct connection channel with each file source capable of providing a target file, wherein the file source comprises: the device which downloads the target file and/or the device which is downloading the target file currently, wherein the direct connection request is sent to the node device by the target device based on the file source address of each file source;
according to the direct connection request, establishing a direct connection channel between the target device and each file source, enabling the target device to use the file source which establishes the direct connection channel with the target device as a target file source, sending a data acquisition request to the target file source, and enabling the target file source to return file blocks of the target file required by the target device to the target device.
7. The method of claim 6, further comprising:
receiving a data acquisition request sent by the target equipment, and judging whether file blocks required by the data acquisition request are stored locally or not according to the data acquisition request;
and if the file source corresponding to the data acquisition request is not the target device, the data acquisition request is continuously forwarded to the file source corresponding to the data acquisition request.
8. The method of claim 6, wherein establishing a direct connection channel between the target device and each file source according to the direct connection request comprises:
and analyzing to obtain the port information of each file source and the port information of the target equipment according to the direct connection request, forwarding the port information of each file source to the target equipment, and forwarding the port information of the target equipment to each file source, so that the target equipment establishes a direct connection channel with each file source according to the port information of each file source.
9. An apparatus for file transfer, comprising:
a file determination module for the device to determine a target file;
an address determining module, configured to determine a file source address of each file source capable of providing the target file, where the file source includes: a device that has downloaded the target file, and/or a device that is currently downloading the target file;
the direct connection request module is used for sending a direct connection request for establishing a direct connection channel between the device and each file source to node equipment in a block chain transmission network (BTN) according to the file source address of each file source, so that the node equipment forwards the direct connection request corresponding to each file source to the file source respectively;
and the data request module is used for taking a file source which establishes a direct connection channel with the device as a target file source and sending a data acquisition request to the target file source so as to enable the target file source to return the file blocks in the target file to the device.
10. The apparatus of claim 9, further comprising:
and the indirect acquisition module is used for sending a data acquisition request corresponding to the file source to the node equipment if a direct connection channel is not established between the device and the file source for each file source so as to acquire the file blocks of the target file.
11. An apparatus for file transfer, comprising:
a receiving module, configured to receive, by the apparatus, a direct connection request sent by a target device and used for establishing a direct connection channel with each file source capable of providing a target file, where the file source includes: the device already downloading the target file and/or the device currently downloading the target file, wherein the direct connection request is sent to the device by the target device based on the file source address of each file source, and the device is a node device in a block chain transmission network (BTN);
and the construction module is used for establishing a direct connection channel between the target equipment and each file source according to the direct connection request, so that the target equipment takes the file source which constructs the direct connection channel with the target equipment as a target file source, sends a data acquisition request to the target file source, and makes the target file source return the file blocks of the target file to the target equipment.
12. The apparatus of claim 11, further comprising:
the query module is used for receiving a data acquisition request sent by the target equipment and judging whether file blocks required by the data acquisition request are stored locally or not according to the data acquisition request; and if the file source corresponding to the data acquisition request is not the target device, the data acquisition request is continuously forwarded to the file source corresponding to the data acquisition request.
13. The apparatus according to claim 11, wherein the building module is configured to, according to the direct connection request, parse to obtain port information of each file source and port information of the target device, forward the port information of each file source to the target device, and forward the port information of the target device to each file source, so that the target device establishes a direct connection channel with each file source according to the port information of each file source.
14. A computer-readable storage medium, storing a computer program which, when executed by a processor, implements the method of any of claims 1-5 or 6-8.
15. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of any of claims 1 to 5 or 6 to 8 when executing the program.
CN202210635019.8A 2022-06-06 2022-06-06 File transmission method and device Pending CN115118712A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210635019.8A CN115118712A (en) 2022-06-06 2022-06-06 File transmission method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210635019.8A CN115118712A (en) 2022-06-06 2022-06-06 File transmission method and device

Publications (1)

Publication Number Publication Date
CN115118712A true CN115118712A (en) 2022-09-27

Family

ID=83326872

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210635019.8A Pending CN115118712A (en) 2022-06-06 2022-06-06 File transmission method and device

Country Status (1)

Country Link
CN (1) CN115118712A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109347968A (en) * 2018-11-07 2019-02-15 网宿科技股份有限公司 A kind of method, apparatus and system of data block that downloading resource file
CN110298194A (en) * 2019-06-11 2019-10-01 阿里巴巴集团控股有限公司 Document handling method, device, equipment and storage medium based on block chain
CN112131227A (en) * 2020-09-29 2020-12-25 深圳前海微众银行股份有限公司 Data query method and device based on alliance chain
CN113726873A (en) * 2021-08-27 2021-11-30 平安科技(深圳)有限公司 Block chain-based file processing method, system, device and storage medium
CN113965560A (en) * 2020-07-01 2022-01-21 中兴通讯股份有限公司 Data transmission method, proxy server, storage medium, and electronic device
CN114465998A (en) * 2021-12-14 2022-05-10 深圳市优必选科技股份有限公司 Multi-device file transmission method and device, terminal device and readable storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109347968A (en) * 2018-11-07 2019-02-15 网宿科技股份有限公司 A kind of method, apparatus and system of data block that downloading resource file
CN110298194A (en) * 2019-06-11 2019-10-01 阿里巴巴集团控股有限公司 Document handling method, device, equipment and storage medium based on block chain
CN113965560A (en) * 2020-07-01 2022-01-21 中兴通讯股份有限公司 Data transmission method, proxy server, storage medium, and electronic device
CN112131227A (en) * 2020-09-29 2020-12-25 深圳前海微众银行股份有限公司 Data query method and device based on alliance chain
CN113726873A (en) * 2021-08-27 2021-11-30 平安科技(深圳)有限公司 Block chain-based file processing method, system, device and storage medium
CN114465998A (en) * 2021-12-14 2022-05-10 深圳市优必选科技股份有限公司 Multi-device file transmission method and device, terminal device and readable storage medium

Similar Documents

Publication Publication Date Title
CN111461887B (en) Block chain consensus processing method and device and electronic equipment
CN111581563A (en) Page response method and device, storage medium and electronic equipment
US7801883B2 (en) Method and apparatus for improving data processing speed through storage of record information of identity module
CN110276194B (en) Information processing method, information processing apparatus, and electronic device
CN108334340B (en) Cross-environment data communication method, device and system
CN111694639B (en) Updating method and device of process container address and electronic equipment
CN108846129B (en) Storage data access method, device and storage medium
CN111241040B (en) Information acquisition method and device, electronic equipment and computer storage medium
CN112395253A (en) Index file generation method, terminal device, electronic device and medium
CN111651467A (en) Block chain link point interface issuing and calling method and device
CN111694992B (en) Data processing method and device
CN111355672A (en) Message forwarding method and device
CN113342419B (en) Push system loading method and device, electronic equipment and storage medium
CN106156050B (en) Data processing method and device
CN113239047A (en) Database allocation method, service processing method, device and equipment
CN112286706A (en) Remote and rapid acquisition method for application information of android application and related equipment
CN115118712A (en) File transmission method and device
CN115129728A (en) File checking method and device
CN115174553A (en) File transmission method and device
CN112114871B (en) Code sharing method, device, server, terminal and medium
CN112084006B (en) Mirror image package processing method and device and electronic equipment
CN111200608B (en) Link information processing method and device
CN109756550B (en) Intelligent internet driving vehicle cloud communication method, device and system
CN112596780A (en) Service execution method and device
CN112596733A (en) Method, device, storage medium and electronic equipment for compiling and acquiring file

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