CN111147186B - Data transmission method and device, computer equipment and storage medium - Google Patents

Data transmission method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN111147186B
CN111147186B CN201911399560.8A CN201911399560A CN111147186B CN 111147186 B CN111147186 B CN 111147186B CN 201911399560 A CN201911399560 A CN 201911399560A CN 111147186 B CN111147186 B CN 111147186B
Authority
CN
China
Prior art keywords
target node
hole
address
transmission
node
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
CN201911399560.8A
Other languages
Chinese (zh)
Other versions
CN111147186A (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.)
Shenzhen Onething Technology Co Ltd
Original Assignee
Shenzhen Onething Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Onething Technology Co Ltd filed Critical Shenzhen Onething Technology Co Ltd
Priority to CN201911399560.8A priority Critical patent/CN111147186B/en
Publication of CN111147186A publication Critical patent/CN111147186A/en
Application granted granted Critical
Publication of CN111147186B publication Critical patent/CN111147186B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/004Arrangements for detecting or preventing errors in the information received by using forward error control
    • H04L1/0056Systems characterized by the type of code used
    • H04L1/0067Rate matching
    • H04L1/0068Rate matching by puncturing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/256NAT traversal
    • 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
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/164Adaptation or special uses of UDP protocol

Abstract

The invention provides a data transmission method, which is applied to computer equipment, and comprises the following steps: acquiring a hole transmission ID, a hole transmission protocol port and an external IP address of a router of a target node; judging the type of the target node according to the hole transmission ID and the router external IP address; if the target node is an intranet node, establishing a hole transmission channel to the target node according to the hole transmission ID, the hole transmission protocol port and the router external IP address; and carrying out data transmission with the target node through the hole transmission channel. The invention also provides a data transmission device, computer equipment and a storage medium. The invention can support the data transmission between the computer equipment and the intranet node.

Description

Data transmission method and device, computer equipment and storage medium
Technical Field
The present invention relates to the field of computer networks, and in particular, to a data transmission method and apparatus, a computer device, and a computer readable storage medium.
Background
Data transmission between different devices is required for the network. However, the existing data transmission method can conveniently perform data transmission from the external network node, and the data transmission with the internal network node is complicated.
Disclosure of Invention
In view of the foregoing, there is a need for a data transmission method, a data transmission apparatus, a computer device, a computer readable storage medium, and a computer program product that can support data transmission between a computer device and an intranet node.
A first aspect of the present application provides a data transmission method, applied to a computer device, the method including:
acquiring a hole transmission ID, a hole transmission protocol port and an external IP address of a router of a target node;
judging the type of the target node according to the hole transmission ID and the router external IP address;
if the target node is an intranet node, establishing a hole transmission channel to the target node according to the hole transmission ID, the hole transmission protocol port and the router external IP address;
and carrying out data transmission with the target node through the hole transmission channel.
In another possible implementation manner, the target node stores a target file, and the obtaining the hole transmission ID, the hole transmission protocol port and the router external IP address of the target node includes:
sending a downloading request for the target file;
receiving index information of the target file returned by the index node in response to the downloading request;
And acquiring the hole punching transmission ID, the hole punching transmission protocol port and the router external IP address from the index information.
In another possible implementation manner, the determining the type of the target node according to the hole-punched transmission ID and the router external IP address includes:
acquiring an external network IP address of the target node;
judging whether the external network IP address of the target node is equal to the router external IP address of the target node or not, and judging whether the hole punching transmission ID of the target node is empty or not;
and if the external network IP address of the target node is not equal to the router external IP address of the target node and the hole punching transmission ID of the target node is not null, the target node is an intranet node.
In another possible implementation manner, the determining the type of the target node according to the hole-punched transmission ID and the router external IP address further includes:
if the external network IP address of the target node is equal to the router external IP address of the target node and the hole punching transmission ID of the target node is null, the target node is an external network node;
the method further comprises the steps of:
and if the target node is an external network node, carrying out data transmission with the target node through direct communication.
In another possible implementation manner, before the establishing a hole transmission channel to the target node according to the hole transmission ID, the hole transmission protocol port and the router external IP address, the method further includes:
judging whether the computer equipment and the target node support hole transmission or not according to NAT types of the computer equipment and the target node;
if the computer equipment and the target node support the hole punching transmission, a hole punching transmission channel to the target node is established according to the hole punching transmission ID, the hole punching transmission protocol port and the router external IP address.
In another possible implementation manner, the method further includes:
and if the hole transmission is not supported between the computer equipment and the target node, carrying out data transmission with the target node through an intermediate node.
In another possible implementation manner, the establishing a hole transmission channel to the target node according to the hole transmission ID, the hole transmission protocol port and the router external IP address includes:
transmitting a hole punching request message to a hole punching server according to the hole punching transmission ID, the hole punching transmission protocol port and the router external IP address;
Receiving address information of the target node returned by the hole punching server in response to the hole punching request message;
and sending UDP data packets to the target node according to the address information of the target node.
A second aspect of the present application provides a computer device comprising a memory and a processor, the memory having stored thereon a computer program executable on the processor, the computer program implementing the data transmission method when executed by the processor.
A third aspect of the present application provides a data transmission apparatus for use in a computer device, the apparatus comprising:
the acquisition unit is used for acquiring the hole transmission ID, the hole transmission protocol port and the router external IP address of the target node;
the judging unit is used for judging the type of the target node according to the hole transmission ID and the router external IP address;
the hole punching unit is used for establishing a hole punching transmission channel to the target node according to the hole punching transmission ID, the hole punching transmission protocol port and the router external IP address if the target node is an intranet node;
and the transmission unit is used for carrying out data transmission with the target node through the hole transmission channel.
In another possible implementation manner, the target node stores a target file, and the obtaining the hole transmission ID, the hole transmission protocol port and the router external IP address of the target node includes:
sending a downloading request for the target file;
receiving index information of the target file returned by the index node in response to the downloading request;
and acquiring the hole punching transmission ID, the hole punching transmission protocol port and the router external IP address from the index information.
In another possible implementation manner, the determining the type of the target node according to the hole-punched transmission ID and the router external IP address includes:
acquiring an external network IP address of the target node;
judging whether the external network IP address of the target node is equal to the router external IP address of the target node or not, and judging whether the hole punching transmission ID of the target node is empty or not;
and if the external network IP address of the target node is not equal to the router external IP address of the target node and the hole punching transmission ID of the target node is not null, the target node is an intranet node.
In another possible implementation manner, the determining the type of the target node according to the hole-punched transmission ID and the router external IP address further includes:
If the external network IP address of the target node is equal to the router external IP address of the target node and the hole punching transmission ID of the target node is null, the target node is an external network node;
the transmission unit is further configured to:
and if the target node is an external network node, carrying out data transmission with the target node through direct communication.
In another possible implementation manner, before the establishing a hole transmission channel to the target node according to the hole transmission ID, the hole transmission protocol port and the router external IP address, the method further includes:
judging whether the computer equipment and the target node support hole transmission or not according to NAT types of the computer equipment and the target node;
if the computer equipment and the target node support the hole punching transmission, a hole punching transmission channel to the target node is established according to the hole punching transmission ID, the hole punching transmission protocol port and the router external IP address.
In another possible implementation manner, the transmission unit is further configured to:
and if the hole transmission is not supported between the computer equipment and the target node, carrying out data transmission with the target node through an intermediate node.
In another possible implementation manner, the establishing a hole transmission channel to the target node according to the hole transmission ID, the hole transmission protocol port and the router external IP address includes:
transmitting a hole punching request message to a hole punching server according to the hole punching transmission ID, the hole punching transmission protocol port and the router external IP address;
receiving address information of the target node returned by the hole punching server in response to the hole punching request message;
and sending UDP data packets to the target node according to the address information of the target node.
A fourth aspect of the present application provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the data transmission method.
A fifth aspect of the present application provides a computer program product comprising computer instructions which, when run on a computer device, cause the computer device to perform the data transmission method.
The method comprises the steps of obtaining a hole punching transmission ID of a target node, a hole punching transmission protocol port and an external IP address of a router; judging whether the target node is an intranet node according to the hole transmission ID of the target node of the target file and the router external IP, and establishing a hole transmission channel to the target node according to the hole transmission ID, the hole transmission protocol port and the router external IP address when the target node is the intranet node, and carrying out data transmission by utilizing the hole transmission channel and the target node. The invention supports the data transmission between the computer equipment and the intranet node, and solves the technical problem that the prior art cannot perform data transmission with the intranet node.
Drawings
Fig. 1 is a flowchart of a data transmission method according to an embodiment of the present invention.
Fig. 2 is a flowchart of a data transmission device according to an embodiment of the present invention.
Fig. 3 is a schematic diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present invention more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The terms "first," "second," "third," "fourth" and the like in the description and in the claims of this application and in the above-described figures, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. The terms "first," "second," "third," "fourth," and the like are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, apparatus, article, or device that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed or inherent to such process, method, article, or device.
The technical solutions between the embodiments of the present application may be combined with each other, but must be based on the fact that those skilled in the art can implement the technical solutions, and when the technical solutions are contradictory or cannot be implemented, the combination of the technical solutions should be considered as not existing, and not falling within the scope of protection claimed by the present invention.
Preferably, the data transmission method of the present invention is applied in one or more computer devices. The computer device is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and its hardware includes, but is not limited to, a microprocessor, an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a programmable gate array (Field-Programmable Gate Array, FPGA), a digital processor (Digital Signal Processor, DSP), an embedded device, and the like.
The computer devices include, but are not limited to, desktop computers, laptop computers, personal digital assistants, tablet computers, personal cloud drives, smartphones, electronic book readers, MP3 (Moving Picture Experts Group Audio Layer III, dynamic image expert compression standard audio plane 3) or MP4 (Moving Picture Experts Group Audio Layer IV, dynamic image expert compression standard audio plane 4) players, POS terminals, and car computers, among others. The computer equipment can perform man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch pad or voice control equipment and the like.
The computer device may be a node that makes up a CDN (Content Delivery Network ) network or a blockchain network.
Example 1
Fig. 1 is a flowchart of a data transmission method according to an embodiment of the present invention. The data transmission method is applied to computer equipment. The data transmission method supports the data transmission between the computer equipment and a target node (i.e. an intranet node) in an internal network. The computer device may be located behind a network address translation (Network Address Translation, NAT) device. The NAT device is an IETF (Internet Engineering Task Force ) standard that allows an entire organization to appear on the Internet with a public IP (Internet Protocol ) address. The NAT device may include, but is not limited to: carrier telecommunications, and corporate network outlet equipment.
The computer device may be in an internal network (i.e., an intranet node) different from the target node, or may be in an external network (i.e., an extranet node).
The target node may be a desktop computer, a notebook computer, a palm computer, a cloud server, etc.
In an embodiment, the computer device and the target node may be a personal cloud disk, such as a guest cloud.
Referring to fig. 1, the data transmission method specifically includes the following steps:
101, acquiring a hole transmission ID, a hole transmission protocol port and an external IP address of a router of a target node.
The hole-punched transmission ID of the target node is used to identify the target node.
The hole transmission protocol port refers to a service port of the hole server, and is used for establishing a hole transmission channel through the hole server.
The router external IP address of the target node is an external IP address obtained from the router by which the target node communicates with the router.
In an embodiment, the target node stores a target file, and the obtaining the hole-forming transmission ID, the hole-forming transmission protocol port and the router external IP address of the target node includes:
(1) And sending a downloading request for the target file.
The download request includes a file name of the target file.
A file download interface may be provided through which the computer device issues the download request. For example, the file download interface may include a file name input box at which the computer device issues the download request by entering the file name of the target file. For another example, the file download interface includes a hot file download bar, where the hot file download bar displays a plurality of hot files, and the computer device issues the download request by clicking the hot files in the hot file download bar.
(2) And receiving index information of the target file returned by the index node in response to the downloading request.
Index information of the target file can be searched by using the index node. And the index node searches index information of the target file from an index database according to the file name of the target file, and returns the index information to the computer device.
In this embodiment, the target file is stored in the target node in a piece-wise manner, and the storage index of the target file is in a secondary index structure, that is, the index information of the target file includes a first-level index and a second-level index. The first level index mainly records the size and the fragment information (including the number of fragments, the names of fragments, the sizes of fragments and the like) of the target file, and the second level index records the node information (including the hole transmission ID, the hole transmission protocol port, the router external IP address and the like) of the target node of each fragment of the target file. The index node searches a first-level index of the target file according to the file name of the target file, searches a second-level index of the target file according to the first-level index of the target file, and obtains node information of target nodes (which can correspond to a plurality of target nodes) of each fragment of the target file from the second-level index.
In other embodiments, the target file may be stored entirely (i.e., not fragmented) in the target node. Correspondingly, the index node searches node information of a target node (corresponding to one target node) of the target file according to the file name of the target file.
Other index structures, such as a primary index structure, a tertiary index structure, etc., may be used for the data transmission method.
(3) And acquiring the hole punching transmission ID, the hole punching transmission protocol port and the router external IP address from the index information.
The target file is a file that the computer device needs to download. The target file may be a different type of file, such as a video file, an audio file, a text file, a picture file, etc.
In an embodiment, the index information of the target file returned by the index node further includes a NAT type of the target node.
The NAT type of the target node may include full cone, restricted cone, port restricted cone, symmetrical.
102, judging the type of the target node according to the hole transmission ID and the router external IP address.
In this embodiment, the determining the type of the target node according to the hole-punched transmission ID and the router external IP address includes:
Acquiring an external network IP address of the target node;
judging whether the external network IP address of the target node is equal to the router external IP address of the target node or not, and judging whether the hole punching transmission ID of the target node is empty or not;
if the external network IP address of the target node is not equal to the router external IP address of the target node and the hole punching transmission ID of the target node is not null, the target node is an intranet node;
and if the external network IP address of the target node is equal to the router external IP address of the target node and the hole punching transmission ID of the target node is null, the target node is the external network node.
The external network IP address of the target node is an IP address allocated to the target node when the target node accesses the network.
103, if the target node is an intranet node, establishing a hole transmission channel to the target node according to the hole transmission ID, the hole transmission protocol port and the router external IP address.
In an embodiment, before the establishing a hole transmission channel to the target node according to the hole transmission ID, the hole transmission protocol port and the router external IP address, the method further comprises:
And judging whether the computer equipment and the target node support hole transmission or not according to NAT types of the computer equipment and the target node.
If the computer equipment and the target node support hole punching transmission, establishing a hole punching transmission channel to the target node according to the hole punching transmission ID, the hole punching transmission protocol port and the router external IP address;
and if the hole transmission is not supported between the computer equipment and the target node, carrying out data transmission with the target node through an intermediate node.
The intermediate node is a node which can perform data transmission with the computer equipment and also perform data transmission with the target node. The intermediate node performs data transfer between the computer device and the target node.
NAT types for computer devices may include full cone, restricted cone, port restricted cone, symmetrical.
The determining whether the computer device and the target node support the hole transmission according to the NAT type of the computer device and the target node comprises:
if the NAT type of any one of the computer equipment and the target node is symmetrical, the NAT type of the other party is port-limited conical, or if the NAT types of the computer equipment and the target node are symmetrical, no hole transmission is supported between the computer equipment and the target node.
In an embodiment, the establishing a hole transmission channel to the target node according to the hole transmission ID, the hole transmission protocol port, and the router external IP address comprises:
sending a hole request message to a hole server according to the hole transmission protocol port and the router external IP address, and requesting the hole server to help establish UDP connection with the target node;
receiving address information of the target node returned by the hole punching server in response to the hole punching request message;
and sending UDP data packets to the target node according to the address information of the target node.
And after receiving the hole punching request message, the hole punching server sends the address information of the target node to the computer equipment, and simultaneously sends the address information of the computer equipment to the target node. The address information of the computer device may include an IP address and a port number of the computer device, and the address information of the target node may include an IP address and a port number of the target node.
And after receiving the address information of the computer equipment returned by the hole punching server, the target node sends a UDP data packet to the computer equipment according to the address information of the computer equipment. Once the computer device and the target node both send data packets to each other, a hole transmission channel from the computer device to the target node is established.
104, performing data transmission with the target node through the hole transmission channel.
For example, downloading a target file from the target node via the hole-punched transmission channel.
The downloading, by the hole transmission channel, the target file from the target node may include:
sending a file request to the target node through the hole transmission channel;
and receiving the target file returned by the target node through the hole transmission channel.
In the data transmission method of the first embodiment, a hole-punching transmission ID, a hole-punching transmission protocol port and an external router IP address of a target node are obtained, whether the target node is an intranet node is judged according to the hole-punching transmission ID of the target node of a target file and the external router IP address, and when the target node is the intranet node, a hole-punching transmission channel to the target node is established according to the hole-punching transmission ID, the hole-punching transmission protocol port and the external router IP address, and data transmission is performed by using the hole-punching transmission channel. The data transmission method supports the data transmission between the computer equipment and the intranet node, and solves the technical problem that the prior art cannot perform data transmission with the intranet node.
In another embodiment, the method further comprises:
and if the target node is an external network node, carrying out data transmission with the target node through direct communication.
Example two
Fig. 2 is a block diagram of a data transmission device according to an embodiment of the present invention. The data transmission device 20 is applied to a computer apparatus. The data transmission device 20 supports data transmission between the computer device and a target node (i.e., an intranet node) in an internal network. The computer device may be located behind a network address translation (Network Address Translation, NAT) device. The NAT device is an IETF (Internet Engineering Task Force ) standard that allows an entire organization to appear on the Internet with a public IP (Internet Protocol ) address. The NAT device may include, but is not limited to: carrier telecommunications, and corporate network outlet equipment.
The computer device may be in an internal network (i.e., an intranet node) different from the target node, or may be in an external network (i.e., an extranet node).
The target node may be a desktop computer, a notebook computer, a palm computer, a cloud server, etc.
In an embodiment, the computer device and the target node may be a personal cloud disk, such as a guest cloud.
As shown in fig. 2, the data transmission device 20 may include: an acquisition unit 201, a judgment unit 202, a punching unit 203, and a transmission unit 204.
An obtaining unit 201, configured to obtain a hole-forming transmission ID, a hole-forming transmission protocol port, and an external IP address of the router of the target node.
The hole-punched transmission ID of the target node is used to identify the target node.
The hole transmission protocol port refers to a service port of the hole server, and is used for establishing a hole transmission channel through the hole server.
The router external IP address of the target node is an external IP address obtained from the router by which the target node communicates with the router.
In an embodiment, the target node stores a target file, and the obtaining the hole-forming transmission ID, the hole-forming transmission protocol port and the router external IP address of the target node includes:
(1) And sending a downloading request for the target file.
The download request includes a file name of the target file.
A file download interface may be provided through which the computer device issues the download request. For example, the file download interface may include a file name input box at which the computer device issues the download request by entering the file name of the target file. For another example, the file download interface includes a hot file download bar, where the hot file download bar displays a plurality of hot files, and the computer device issues the download request by clicking the hot files in the hot file download bar.
(2) And receiving index information of the target file returned by the index node in response to the downloading request.
Index information of the target file can be searched by using the index node. And the index node searches index information of the target file from an index database according to the file name of the target file, and returns the index information to the computer device.
In this embodiment, the target file is stored in the target node in a piece-wise manner, and the storage index of the target file is in a secondary index structure, that is, the index information of the target file includes a first-level index and a second-level index. The first level index mainly records the size and the fragment information (including the number of fragments, the names of fragments, the sizes of fragments and the like) of the target file, and the second level index records the node information (including the hole transmission ID, the hole transmission protocol port, the router external IP address and the like) of the target node of each fragment of the target file. The index node searches a first-level index of the target file according to the file name of the target file, searches a second-level index of the target file according to the first-level index of the target file, and obtains node information of target nodes (which can correspond to a plurality of target nodes) of each fragment of the target file from the second-level index.
In other embodiments, the target file may be stored entirely (i.e., not fragmented) in the target node. Correspondingly, the index node searches node information of a target node (corresponding to one target node) of the target file according to the file name of the target file.
Other index structures, such as a primary index structure, a tertiary index structure, etc., may be used for the data transmission method.
(3) And acquiring the hole punching transmission ID, the hole punching transmission protocol port and the router external IP address from the index information.
The target file is a file that the computer device needs to download. The target file may be a different type of file, such as a video file, an audio file, a text file, a picture file, etc.
In an embodiment, the index information of the target file returned by the index node further includes a NAT type of the target node.
The NAT type of the target node may include full cone, restricted cone, port restricted cone, symmetrical.
A judging unit 202, configured to judge the type of the target node according to the hole-punched transmission ID and the router external IP address.
In this embodiment, the determining the type of the target node according to the hole-punched transmission ID and the router external IP address includes:
Acquiring an external network IP address of the target node;
judging whether the external network IP address of the target node is equal to the router external IP address of the target node or not, and judging whether the hole punching transmission ID of the target node is empty or not;
if the external network IP address of the target node is not equal to the router external IP address of the target node and the hole punching transmission ID of the target node is not null, the target node is an intranet node;
and if the external network IP address of the target node is equal to the router external IP address of the target node and the hole punching transmission ID of the target node is null, the target node is the external network node.
The external network IP address of the target node is an IP address allocated to the target node when the target node accesses the network.
And the hole punching unit 203 is configured to establish a hole punching transmission channel to the target node according to the hole punching transmission ID, the hole punching transmission protocol port and the router external IP address if the target node is an intranet node.
In an embodiment, before the establishing a hole transmission channel to the target node according to the hole transmission ID, the hole transmission protocol port and the router external IP address, the method further comprises:
And judging whether the computer equipment and the target node support hole transmission or not according to NAT types of the computer equipment and the target node.
If the computer equipment and the target node support hole punching transmission, establishing a hole punching transmission channel to the target node according to the hole punching transmission ID, the hole punching transmission protocol port and the router external IP address;
and if the hole transmission is not supported between the computer equipment and the target node, carrying out data transmission with the target node through an intermediate node.
The intermediate node is a node which can perform data transmission with the computer equipment and also perform data transmission with the target node. The intermediate node performs data transfer between the computer device and the target node.
NAT types for computer devices may include full cone, restricted cone, port restricted cone, symmetrical.
The determining whether the computer device and the target node support the hole transmission according to the NAT type of the computer device and the target node comprises:
if the NAT type of any one of the computer equipment and the target node is symmetrical, the NAT type of the other party is port-limited conical, or if the NAT types of the computer equipment and the target node are symmetrical, no hole transmission is supported between the computer equipment and the target node.
In an embodiment, the establishing a hole transmission channel to the target node according to the hole transmission ID, the hole transmission protocol port, and the router external IP address comprises:
sending a hole request message to a hole server according to the hole transmission protocol port and the router external IP address, and requesting the hole server to help establish UDP connection with the target node;
receiving address information of the target node returned by the hole punching server in response to the hole punching request message;
and sending UDP data packets to the target node according to the address information of the target node.
And after receiving the hole punching request message, the hole punching server sends the address information of the target node to the computer equipment, and simultaneously sends the address information of the computer equipment to the target node. The address information of the computer device may include an IP address and a port number of the computer device, and the address information of the target node may include an IP address and a port number of the target node.
And after receiving the address information of the computer equipment returned by the hole punching server, the target node sends a UDP data packet to the computer equipment according to the address information of the computer equipment. Once the computer device and the target node both send data packets to each other, a hole transmission channel from the computer device to the target node is established.
And the transmission unit 204 is used for transmitting data with the target node through the hole transmission channel.
For example, downloading a target file from the target node via the hole-punched transmission channel.
The downloading, by the hole transmission channel, the target file from the target node may include:
sending a file request to the target node through the hole transmission channel;
and receiving the target file returned by the target node through the hole transmission channel.
The data transmission device 20 of the second embodiment obtains the hole-punching transmission ID, the hole-punching transmission protocol port and the router external IP address of the target node, determines whether the target node is an intranet node according to the hole-punching transmission ID and the router external IP address of the target node of the target file, and establishes a hole-punching transmission channel to the target node according to the hole-punching transmission ID, the hole-punching transmission protocol port and the router external IP address when the target node is the intranet node, and uses the hole-punching transmission channel to perform data transmission. The data transmission device 20 supports data transmission between the computer equipment and the intranet node, and solves the technical problem that the prior art cannot perform data transmission with the intranet node.
In another embodiment, the transmission unit 204 is further configured to:
and if the target node is an external network node, carrying out data transmission with the target node through direct communication.
Example III
The present embodiment provides a computer readable storage medium having a computer program stored thereon, which when executed by a processor, implements the steps of the above-described data transmission method embodiment, such as 101-104 shown in fig. 1:
101, acquiring a hole transmission ID, a hole transmission protocol port and an external IP address of a router of a target node;
102, judging the type of the target node according to the hole transmission ID and the router external IP address;
103, if the target node is an intranet node, establishing a hole transmission channel to the target node according to the hole transmission ID, the hole transmission protocol port and the router external IP address;
104, performing data transmission with the target node through the hole transmission channel.
Alternatively, the computer program, when executed by a processor, performs the functions of the modules/units in the above-described apparatus embodiments, e.g., units 201-204 in fig. 2:
an obtaining unit 201, configured to obtain a hole-forming transmission ID, a hole-forming transmission protocol port, and an external IP address of a router of a target node;
A judging unit 202, configured to judge a type of the target node according to the hole-punched transmission ID and the router external IP address;
a hole punching unit 203, configured to establish a hole punching transmission channel to the target node according to the hole punching transmission ID, the hole punching transmission protocol port, and the router external IP address if the target node is an intranet node;
and the transmission unit 204 is used for transmitting data with the target node through the hole transmission channel.
Example IV
Fig. 3 is a schematic diagram of a computer device according to an embodiment of the present invention. The computer device 3 comprises a memory 30, a processor 31, a bus 33 and a computer program 32 stored in the memory 30 and executable on the processor 31. The steps of the above-described data transmission method embodiments are implemented by the processor 31 when executing the computer program 32, for example 101-104 shown in fig. 1:
101, acquiring a hole transmission ID, a hole transmission protocol port and an external IP address of a router of a target node;
102, judging the type of the target node according to the hole transmission ID and the router external IP address;
103, if the target node is an intranet node, establishing a hole transmission channel to the target node according to the hole transmission ID, the hole transmission protocol port and the router external IP address;
104, performing data transmission with the target node through the hole transmission channel.
Alternatively, the processor 31 may perform the functions of the modules/units of the above-described apparatus embodiments when executing the computer program 32, e.g. the units 201-204 of fig. 2:
an obtaining unit 201, configured to obtain a hole-forming transmission ID, a hole-forming transmission protocol port, and an external IP address of a router of a target node;
a judging unit 202, configured to judge a type of the target node according to the hole-punched transmission ID and the router external IP address;
a hole punching unit 203, configured to establish a hole punching transmission channel to the target node according to the hole punching transmission ID, the hole punching transmission protocol port, and the router external IP address if the target node is an intranet node;
and the transmission unit 204 is used for transmitting data with the target node through the hole transmission channel.
Illustratively, the computer program 32 may be partitioned into one or more modules/units that are stored in the memory 30 and executed by the processor 31 to complete the present invention. The one or more modules/units may be a series of computer program instruction segments capable of performing the specified functions, which instruction segments are used to describe the execution of the computer program 32 in the computer device 3.
The computer device 3 may be a PC (Personal Computer ), or may be a terminal device such as a smart phone, a tablet computer, a palm computer, a portable computer, an intelligent router, a mining machine, or a network storage device.
The processor 31 may be a central processing unit (Central Processing Unit, CPU), but may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. The general purpose processor may be a microprocessor or the processor 31 may be any conventional processor or the like, the processor 31 being a control center of the computer device 3, the various interfaces and lines being used to connect the various parts of the entire computer device 3.
The memory 30 may be used to store the computer program 32 and/or modules/units, and the processor 31 may implement various functions of the computer device 3 by running or executing the computer program and/or modules/units stored in the memory 30 and invoking data stored in the memory 30. The memory 30 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required for at least one function, and the like; the storage data area may store data created from the use of the computer device 3. In addition, the memory 30 may include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash Card (Flash Card), at least one disk storage device, a Flash memory device, or other non-volatile solid state storage device.
The bus 33 may be a peripheral component interconnect standard (peripheral component interconnect, PCI) bus, an extended industry standard architecture (extended industry standard architecture, EISA) bus, or the like. The bus 33 may be classified into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in fig. 3, but not only one bus or one type of bus.
Further, the computer device 3 may also include a network interface, which may optionally include a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), typically used to establish a communication connection between the computer device 3 and other electronic devices.
Optionally, the computer device 3 may further comprise a user interface, which may comprise a Display (Display), an input unit such as a Keyboard (Keyboard), and optionally a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch, or the like. The display may also be referred to as a display screen or display unit, as appropriate, for displaying information processed in the computer device 3 and for displaying a visual user interface.
It will be appreciated by those skilled in the art that the schematic diagram 3 is merely an example of the computer device 3 and does not constitute a limitation of the computer device 3, and may include more or fewer components than shown, or may combine certain components, or different components.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product.
The computer program product includes one or more computer instructions. When loaded and executed on a computer arrangement, produces, in whole or in part, a flow or function in accordance with embodiments of the present invention. The computer device may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by a wired (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be stored by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), etc.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods may be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another apparatus, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, an optical disk, or other various media capable of storing program codes.
It should be noted that, the foregoing reference numerals of the embodiments of the present invention are merely for describing the embodiments, and do not represent the advantages and disadvantages of the embodiments. And the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method 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, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, apparatus, article or method that comprises the element.
The foregoing description is only of the preferred embodiments of the present invention, and is not intended to limit the scope of the invention, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.

Claims (8)

1. A data transmission method applied to a computer device, the method comprising:
Obtaining the hole transmission ID, the hole transmission protocol port and the router external IP address of the target node, wherein the hole transmission ID, the hole transmission protocol port and the router external IP address comprise: sending a downloading request for a target file stored on the target node; receiving index information of the target file returned by the index node in response to the downloading request; acquiring the hole transmission ID, the hole transmission protocol port and the router external IP address from the index information, wherein the hole transmission ID is used for judging the type of the target node, the hole transmission protocol port is a service port of a hole server, and the router external IP address is an external IP address acquired from the router when the target node communicates with the router;
judging the type of the target node according to the hole transmission ID and the router external IP address, wherein the method comprises the following steps: acquiring an external network IP address of the target node; judging whether the external network IP address of the target node is equal to the router external IP address of the target node or not, and judging whether the hole punching transmission ID of the target node is empty or not; if the external network IP address of the target node is not equal to the router external IP address of the target node and the hole punching transmission ID of the target node is not null, the target node is an intranet node;
If the target node is an intranet node, establishing a hole transmission channel to the target node according to the hole transmission ID, the hole transmission protocol port and the router external IP address;
and carrying out data transmission with the target node through the hole transmission channel.
2. The method of claim 1, wherein said determining the type of the target node based on the hole-punched transport ID and the router external IP address further comprises:
if the external network IP address of the target node is equal to the router external IP address of the target node and the hole punching transmission ID of the target node is null, the target node is an external network node;
the method further comprises the steps of:
and if the target node is an external network node, carrying out data transmission with the target node through direct communication.
3. The method of claim 1, wherein prior to the establishing a hole transport path to the target node based on the hole transport ID, the hole transport protocol port, and the router external IP address, the method further comprises:
judging whether the computer equipment and the target node support hole transmission or not according to NAT types of the computer equipment and the target node;
If the computer equipment and the target node support the hole punching transmission, a hole punching transmission channel to the target node is established according to the hole punching transmission ID, the hole punching transmission protocol port and the router external IP address.
4. A method as claimed in claim 3, wherein the method further comprises:
and if the hole transmission is not supported between the computer equipment and the target node, carrying out data transmission with the target node through an intermediate node.
5. The method of any of claims 1 to 4, wherein the establishing a hole transport path to the target node based on the hole transport ID, the hole transport protocol port, and the router external IP address comprises:
transmitting a hole punching request message to a hole punching server according to the hole punching transmission ID, the hole punching transmission protocol port and the router external IP address;
receiving address information of the target node returned by the hole punching server in response to the hole punching request message;
and sending UDP data packets to the target node according to the address information of the target node.
6. A computer device, characterized in that it comprises a memory and a processor, on which a computer program is stored which is executable on the processor, the computer program, when executed by the processor, implementing the data transmission method according to any one of claims 1 to 5.
7. A data transmission apparatus for use with a computer device of a distributed storage network, the apparatus comprising:
an obtaining unit, configured to obtain a hole-punching transmission ID, a hole-punching transmission protocol port, and an external IP address of a router of a target node, including: sending a downloading request for a target file stored on the target node; receiving index information of the target file returned by the index node in response to the downloading request; acquiring the hole transmission ID, the hole transmission protocol port and the router external IP address from the index information, wherein the hole transmission ID is used for judging the type of the target node, the hole transmission protocol port is a service port of a hole server, and the router external IP address is an external IP address acquired from the router when the target node communicates with the router;
a judging unit, configured to judge the type of the target node according to the hole-punched transmission ID and the router external IP address, including: acquiring an external network IP address of the target node; judging whether the external network IP address of the target node is equal to the router external IP address of the target node or not, and judging whether the hole punching transmission ID of the target node is empty or not; if the external network IP address of the target node is not equal to the router external IP address of the target node and the hole punching transmission ID of the target node is not null, the target node is an intranet node;
The hole punching unit is used for establishing a hole punching transmission channel to the target node according to the hole punching transmission ID, the hole punching transmission protocol port and the router external IP address if the target node is an intranet node;
and the transmission unit is used for carrying out data transmission with the target node through the hole transmission channel.
8. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a computer program which, when executed by a processor, implements the data transmission method according to any of claims 1 to 5.
CN201911399560.8A 2019-12-30 2019-12-30 Data transmission method and device, computer equipment and storage medium Active CN111147186B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911399560.8A CN111147186B (en) 2019-12-30 2019-12-30 Data transmission method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911399560.8A CN111147186B (en) 2019-12-30 2019-12-30 Data transmission method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111147186A CN111147186A (en) 2020-05-12
CN111147186B true CN111147186B (en) 2023-07-18

Family

ID=70522097

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911399560.8A Active CN111147186B (en) 2019-12-30 2019-12-30 Data transmission method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111147186B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114095470A (en) * 2020-07-29 2022-02-25 顺丰科技有限公司 Block chain node uplink method and device and block chain node

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101741914A (en) * 2010-02-03 2010-06-16 上海悠络客电子科技有限公司 Method and system for penetrating NAT to establish overlay network in P2P network
CN101873359A (en) * 2010-06-28 2010-10-27 北京神州泰岳软件股份有限公司 Method for implementing UDP hole punching
WO2016201966A1 (en) * 2015-06-18 2016-12-22 中兴通讯股份有限公司 Nat traversal method, apparatus and system
CN108600316A (en) * 2018-03-23 2018-09-28 深圳市网心科技有限公司 Data managing method, system and the equipment of cloud storage service

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101895590A (en) * 2010-07-23 2010-11-24 华南理工大学 UDT-based system and method for realizing network address translator traversal
CN106550058A (en) * 2015-09-17 2017-03-29 群晖科技股份有限公司 Network address translation penetration method and system using same
US11074226B2 (en) * 2017-05-24 2021-07-27 3S International, LLC Hierarchical computing network and methods thereof
CN109660639B (en) * 2018-12-11 2022-02-25 深圳市迅雷网络技术有限公司 Data uploading method, device, system and medium
CN109788051A (en) * 2019-01-02 2019-05-21 深圳市网心科技有限公司 Network resource transmission method and system based on distributed file system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101741914A (en) * 2010-02-03 2010-06-16 上海悠络客电子科技有限公司 Method and system for penetrating NAT to establish overlay network in P2P network
CN101873359A (en) * 2010-06-28 2010-10-27 北京神州泰岳软件股份有限公司 Method for implementing UDP hole punching
WO2016201966A1 (en) * 2015-06-18 2016-12-22 中兴通讯股份有限公司 Nat traversal method, apparatus and system
CN108600316A (en) * 2018-03-23 2018-09-28 深圳市网心科技有限公司 Data managing method, system and the equipment of cloud storage service

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于NAT穿透P2P即时通讯系统的设计与实现;张静颐;赵雪岩;陈爱网;;电子设计工程(第07期);全文 *

Also Published As

Publication number Publication date
CN111147186A (en) 2020-05-12

Similar Documents

Publication Publication Date Title
CN110677493B (en) Service state determination method and device, computer device and storage medium
KR102504075B1 (en) Matching and attributes of user device events
CN102810066A (en) Terminal adapting method and terminal and server based on terminal characteristic configuration program
CN109618174B (en) Live broadcast data transmission method, device, system and storage medium
CN111343048B (en) Pressure testing method and device, computer device and storage medium
US20170017480A1 (en) Method and apparatus for updating an application in a user terminal
US20140089397A1 (en) Method, server, and client for pushing and displaying splash screen
US20200358868A1 (en) Tags for Automatic Cloud Resource Provisioning
CN110417789B (en) Server connection method, electronic device, system and medium
CN111142799A (en) Distributed storage method and device, network node and storage medium
CN110677506B (en) Network access method, device, computer equipment and storage medium
CN111147186B (en) Data transmission method and device, computer equipment and storage medium
CN110808974A (en) Data acquisition method and device, computer device and storage medium
CN110730244A (en) Networking method and system of DHT (distributed hash table) system, network equipment and storage medium
CN111314458A (en) Method and device for punching P2P network and computer readable storage medium
CN108563668A (en) The method, apparatus and terminal device of the Hybrid page jump H5 pages
US9201960B2 (en) Virtual agent response to customer inquiries
CN107480240B (en) Database system and data processing method thereof
US20140297953A1 (en) Removable Storage Device Identity and Configuration Information
CN110365783B (en) File deployment method and device, network node and storage medium
JP6591016B1 (en) Content browsing history acquisition system and content browsing history acquisition method
CN111031117A (en) Multimedia file downloading method and related device
CN105589870B (en) Method and system for filtering webpage advertisements
US10237592B2 (en) Method and apparatus for video transmission
JP6932677B2 (en) Mobile devices, systems, access methods, and programs

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