CN109495599B - Data transmission method and system, electronic device and computer readable storage medium - Google Patents

Data transmission method and system, electronic device and computer readable storage medium Download PDF

Info

Publication number
CN109495599B
CN109495599B CN201811367118.2A CN201811367118A CN109495599B CN 109495599 B CN109495599 B CN 109495599B CN 201811367118 A CN201811367118 A CN 201811367118A CN 109495599 B CN109495599 B CN 109495599B
Authority
CN
China
Prior art keywords
client
data transmission
sfu
node
transmission channel
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
CN201811367118.2A
Other languages
Chinese (zh)
Other versions
CN109495599A (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 CN201811367118.2A priority Critical patent/CN109495599B/en
Publication of CN109495599A publication Critical patent/CN109495599A/en
Application granted granted Critical
Publication of CN109495599B publication Critical patent/CN109495599B/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
    • 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
    • H04L61/2575NAT traversal using address mapping retrieval, e.g. simple traversal of user datagram protocol through session traversal utilities for NAT [STUN]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions

Abstract

The invention discloses a data transmission method, which is applied to a client, and comprises the following steps: sending a hole punching request to a STUN server to request to establish a P2P data transmission channel with a counterpart client; if the P2P data transmission channel is established successfully, P2P audio and video communication is carried out with the opposite client; if the P2P data transmission channel fails to be established, the SFU node and the opposite client terminal are used for carrying out audio and video data transfer communication. The invention also provides a data transmission system, an electronic device and a computer readable storage medium. The invention can reduce the bandwidth cost and the operation cost and can support audio and video communication among a large number of users.

Description

Data transmission method and system, electronic device and computer readable storage medium
Technical Field
The present invention relates to the field of data transmission technologies, and in particular, to a data transmission method and system, an electronic device, and a computer readable storage medium.
Background
The existing technical scheme for VoIP (Voice over Internet Protocol ) audio and video communication based on a P2P mode comprises: user a and user b establish a P2P hole-punching data transmission channel through a STUN (Simple Traversal of UDP over NATs, UDP of NAT simple traversal) server, if successful, P2P audio and video communication is carried out through the P2P hole-punching data transmission channel; if the communication fails, the communication is transferred to the audio and video data through a relay server on the public network.
However, this approach has the following drawbacks: if VoIP audio and video communication is supported between millions of users online, but the relay server node of the public network is limited, it is likely that the relay requirement among a large number of users cannot be met. In addition, in order to ensure the audio and video communication quality, the bandwidth operation cost of the relay server is expensive, resulting in high communication cost.
Disclosure of Invention
In view of the above, the present invention provides a data transmission method and system, an electronic device and a computer readable storage medium, so as to solve at least one of the above problems.
First, to achieve the above object, the present invention provides a data transmission method, applied to a client, the method comprising:
sending a hole punching request to a STUN server to request to establish a P2P data transmission channel with a counterpart client;
if the P2P data transmission channel is established successfully, P2P audio and video communication is carried out with the opposite client; a kind of electronic device with high-pressure air-conditioning system
If the P2P data transmission channel fails to be established, the selective forwarding unit SFU node and the opposite client side are used for carrying out audio and video data transfer communication.
Optionally, the method further comprises:
and when the establishment of the P2P data transmission channel between the client and the opposite client fails and the transfer communication cannot be carried out through the SFU node, carrying out the transfer data transmission between the client and the opposite client through a public network relay server.
Optionally, the sending a hole punching request to the STUN server to request to establish a P2P data transmission channel with the counterpart client includes:
acquiring own external network IP and port through the STUN server in the nearby area;
sending own external network IP and port to the opposite side client through an Internet network;
acquiring the IP and the port of the opposite client through an Internet network;
and sending a test data packet to the external network IP and the port of the opposite side client side, and receiving the test data packet sent by the opposite side client side so as to establish the P2P data transmission channel.
Optionally, the performing audio and video data transit communication with the counterpart client through the SFU node includes:
selecting the SFU node which can successfully establish a P2P data transmission channel with the client and the opposite client;
the client transmits audio and video data to the SFU node through a P2P data transmission channel between the SFU node and the opposite client so as to transfer the audio and video data to the opposite client through the P2P data transmission channel between the SFU node and the opposite client;
and the client receives the audio and video data transmitted by the opposite client in the SFU node through a P2P data transmission channel between the client and the SFU node.
Optionally, the selecting the SFU node that can successfully establish a P2P data transmission channel with the client and the peer client includes:
selecting a plurality of SFU nodes capable of carrying out P2P data transmission with the NAT type according to the NAT types of the client and the opposite client;
selecting one from the SFU nodes according to a preset rule, attempting to establish a P2P data transmission channel with the client and the opposite client respectively, and taking the SFU node as a transfer between the client and the opposite client if both P2P data transmission channels can be successfully established;
if the establishment of the P2P data transmission channel between the client or the opposite side client and the SFU node fails, continuing to select the next SFU node, and trying to establish the P2P data transmission channel with the client and the opposite side client respectively until the SFU node which can successfully establish the P2P data transmission channel with both the client and the opposite side client is found;
if the SFU node which can successfully establish the P2P data transmission channel with the client and the counterpart client does not exist, the client and the counterpart client can not carry out transfer communication through the SFU node.
Optionally, the SFU node is a node in a content distribution network.
In addition, in order to achieve the above object, the present invention further provides an electronic device, including a memory and a processor, where the memory stores a data transmission program that can be executed on the processor, and the data transmission program implements the data transmission method described above when executed by the processor.
Further, to achieve the above object, the present invention also provides a data transmission system, including:
STUN server;
a selective forwarding unit SFU node;
at least two clients;
the two clients send a hole punching request to the corresponding STUN server to request to establish a P2P data transmission channel with the opposite side;
if the P2P data transmission channel is established successfully, P2P audio and video communication is carried out between the two clients through the P2P data transmission channel;
if the P2P data transmission channel fails to be established, the two clients conduct audio and video data transfer communication through the SFU node.
Optionally, when the P2P data transmission channel between the two clients fails to be established and the relay communication cannot be performed through the SFU node, the two clients perform the relay data transmission through the public network relay server.
Optionally, the performing audio and video data transfer communication between the two clients through the SFU node includes:
selecting the SFU node which can successfully establish a P2P data transmission channel with the two clients;
the two clients respectively transmit audio and video data to the SFU node through a P2P data transmission channel between the SFU node and the opposite client so as to transfer the audio and video data to the opposite client through the P2P data transmission channel between the SFU node and the opposite client;
and the two clients respectively receive the audio and video data transmitted by the opposite client transferred by the SFU node through a P2P data transmission channel between the two clients and the SFU node.
Optionally, the SFU node is a node in a content distribution network.
Further, in order to achieve the above object, the present invention also provides a computer-readable storage medium storing a data transmission program executable by at least one processor to cause the at least one processor to perform the data transmission method as described above.
Compared with the prior art, the data transmission method and system, the electronic device and the computer readable storage medium provided by the invention have the advantages that since the SFU nodes are distributed on the equipment of the user, the bandwidth transmission can be used for free, and the bandwidth cost and the operation cost are greatly reduced compared with the scheme of carrying out relay service through the public network relay server. In addition, the more users that are online at the same time, the more devices that can be used as SFU nodes, so that audio and video communication among a large number of users can be supported.
Drawings
Fig. 1 is a flow chart of a data transmission method according to a first embodiment of the present invention;
FIG. 2 is a schematic diagram of the refinement flow of S10 in FIG. 1;
FIG. 3 is a schematic diagram of the refinement flow of S14 in FIG. 1;
fig. 4 is a flow chart of a data transmission method according to a second embodiment of the present invention;
fig. 5 is a schematic diagram of an architecture of an electronic device according to a third embodiment of the present invention;
fig. 6 is a schematic diagram of a data transmission system according to a fourth embodiment of the present invention;
fig. 7 is a flowchart of a data transmission method according to a fifth embodiment of the present invention;
FIG. 8 is a schematic diagram of a refinement flow of S30 in FIG. 7;
FIG. 9 is a schematic diagram of the refinement flow of S34 in FIG. 7;
fig. 10 is a flowchart of a data transmission method according to a sixth embodiment of the present invention.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
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.
It should be noted that the description of "first", "second", etc. in this disclosure is for descriptive purposes only and is not to be construed as indicating or implying a relative importance or implying an indication of the number of technical features being indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In addition, the technical solutions of the embodiments may be combined with each other, but it is necessary to base that the technical solutions can be realized by those skilled in the art, and when the technical solutions are contradictory or cannot be realized, the combination of the technical solutions should be considered to be absent and not within the scope of protection claimed in the present invention.
First embodiment
Referring to fig. 1, a first embodiment of the present invention proposes a data transmission method applied to a client. In this embodiment, the execution sequence of the steps in the flowchart shown in fig. 1 may be changed, and some steps may be omitted according to different requirements. The method comprises the following steps:
s10, sending a hole punching request to the STUN server to request to establish a P2P data transmission channel with the opposite client.
If P2P audio/video data transmission is needed between the client and the other client, the STUN server tries to establish a P2P data transmission channel.
Referring to fig. 2, fig. 2 is a detailed flowchart of S10. In this embodiment, the step S10 includes:
s100, acquiring own external network IP and port (port) through a STUN server in a nearby area.
S102, sending the own external network IP and port to the opposite side client through the Internet.
S104, obtaining the external network IP and port of the opposite side client through the Internet. The foreign network IP and port of the partner client are acquired by the partner client through the STUN server in the nearby area.
S106, sending test data packets to the external network IP and port of the opposite side client side, and receiving the test data packets sent by the opposite side client side so as to establish a P2P data transmission channel.
And after the client or the opposite side receives the test data packet sent by the opposite side, the client or the opposite side timely feeds back an ACK response frame to the opposite side. And determining that the P2P data transmission channel is successfully established as long as at least one of the client and the opposite client receives the ACK response frame fed back by the opposite side in a preset time. If the client and the opposite client both time out and do not receive the ACK response frame fed back by the opposite side, determining that the P2P data transmission channel is failed to be established.
And S12, when the P2P data transmission channel is successfully established, P2P audio and video communication is carried out with the opposite client.
If the P2P data transmission channel can be established successfully, the client and the opposite client directly send audio and video data to the opposite side through the P2P data transmission channel.
In this embodiment and the embodiments described below, the audio/video data may be VoIP audio/video data.
S14, when the P2P data transmission channel fails to be established, the node and the opposite client side perform audio and video data transfer communication through a selective forwarding unit (Selective Forwarding Unit, SFU).
If the P2P data transmission channel is failed to be established, other modes are needed to be adopted to establish the transmission channel between the client and the opposite client. In this embodiment, an attempt is made to relay communication of audio and video data between the client and the counterpart client through the communication proxy of the SFU node. The SFU node is a node in the content delivery network.
Referring to fig. 3, fig. 3 is a detailed flowchart of S14. In this embodiment, the step S14 includes:
s140, selecting SFU nodes which can successfully establish a P2P data transmission channel with the client and the opposite client.
The SFU node requests that the P2P data transmission channel can be successfully established with the client and the opposite client, and if any party fails to punch holes with the SFU node, the SFU node loses the transfer function. When the P2P data transmission channel fails to be established, according to the NAT types of the client and the counterpart client, an SFU node capable of P2P data transmission with the two NAT types (the client and the counterpart client may be the same NAT type or different NAT types) is selected, and there may be a plurality of SFU nodes. And then selecting one SFU node according to a preset rule (such as a nearby rule), attempting to establish a P2P data transmission channel with the client and the other client respectively, and taking the SFU node as a transfer between the client and the other client if both channels can be successfully established. If the establishment of the P2P data transmission channel between any one of the client and the opposite client and the SFU node fails, the SFU node loses the transfer function, continues to select the next SFU node, and tries to establish the P2P data transmission channel with the client and the opposite client respectively until the SFU node which can successfully establish the P2P data transmission channel with the client and the opposite client is found. If there is no SFU node which can successfully establish the P2P data transmission channel with the client and the other client, the client and the other client cannot transfer communication through the SFU node.
S142, the client transmits audio and video data to the SFU node through a P2P data transmission channel between the SFU node and the opposite client, so as to transfer the audio and video data to the opposite client through the P2P data transmission channel between the SFU node and the opposite client.
S144, the client receives the audio and video data transmitted by the opposite client in the SFU node through the P2P data transmission channel between the client and the SFU node.
According to the data transmission method provided by the embodiment, since SFU nodes are distributed on the equipment of the user, bandwidth transmission can be used for free, and therefore compared with a scheme of carrying out relay service through a public network relay server, bandwidth cost and operation cost can be reduced greatly. In addition, the more users that are online at the same time, the more devices that can be used as SFU nodes, so that audio and video communication among a large number of users can be supported.
Second embodiment
Referring to fig. 4, a second embodiment of the present invention provides a data transmission method. In this embodiment, the execution sequence of the steps in the flowchart shown in fig. 4 may be changed, and some steps may be omitted according to different requirements. In this embodiment, S20 to S24 in the above-described data transmission method are similar to S10 to S14 of the first embodiment, except that the method further includes S26.
S20, sending a hole punching request to the STUN server to request to establish a P2P data transmission channel with the opposite client.
S22, when the P2P data transmission channel is successfully established, P2P audio and video communication is carried out with the opposite client.
S24, when the P2P data transmission channel fails to be established, the SFU node and the opposite client side are used for carrying out audio and video data transfer communication.
S26, when the establishment of the P2P data transmission channel between the client and the opposite client fails and transfer communication cannot be carried out through the SFU node (namely, no SFU node which can successfully establish the P2P hole data transmission channel with the client and the opposite client exists), transfer data transmission between the client and the opposite client is carried out through the public network relay server.
If any one of the client and the other party client fails to punch holes with the SFU node, the SFU node loses the transfer function, and at the moment, the transfer of the public network relay server is needed to realize the audio and video data transmission between the client and the other party client.
According to the data transmission method provided by the embodiment, when the P2P data transmission channel cannot be successfully established between the client and the opposite client, the communication proxy of the SFU node is tried to perform audio and video data transfer communication. Since SFU nodes are distributed on the user's devices, bandwidth transmission can be used for free, so bandwidth cost and operation cost can be reduced much compared with the scheme of relay service through a public network relay server. In addition, the more users that are online at the same time, the more devices that can be used as SFU nodes, so that audio and video communication among a large number of users can be supported. When SFU nodes which can successfully establish a P2P data transmission channel with the client and the counterpart client do not exist, the public network relay server is adopted to realize audio and video data transmission between the client and the counterpart client, so that smooth data transmission is ensured.
Third embodiment
Referring to fig. 5, a third embodiment of the present invention provides an electronic device 10. In this embodiment, the electronic device 10 may be the above-mentioned client.
The electronic device 10 includes: memory 11, processor 13, network interface 15, and communication bus 17. The network interface 15 may alternatively comprise a standard wired interface, a wireless interface (e.g., WI-FI interface), among others. The communication bus 17 is used to enable connection communication between these components.
The memory 11 includes at least one type of readable storage medium. At least one type of the above-described readable storage medium may be a non-volatile storage medium such as a flash memory, a hard disk, a multimedia card, a card-type memory, or the like. In some embodiments, the memory 11 may be an internal storage unit of the electronic device 10, such as a hard disk of the electronic device 10. In other embodiments, the memory 11 may also be an external storage unit of the electronic device 10, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the electronic device 10.
The memory 11 may be used for storing application software installed in the electronic device 10 and various data, such as program codes of the data transmission program 100 and related data generated during the operation process thereof.
The processor 13 may in some embodiments be a central processing unit, microprocessor or other data processing chip for executing program code or processing data stored in the memory 11.
Fig. 5 shows only the electronic device 10 with components 11, 13, 15, 17 and the data transmission program 100, but it should be understood that fig. 5 does not show all components of the electronic device 10 and that more or fewer components may be implemented instead.
In the embodiment of the electronic device 10 shown in fig. 5, as a program code of the data transmission program 100 stored in the memory 11 of a computer storage medium, the processor 13 implements the following method when executing the program code of the data transmission program 100:
(1) And sending a hole punching request to the STUN server to request to establish a P2P data transmission channel with the opposite client.
(2) If the P2P data transmission channel is established successfully, P2P audio and video communication is carried out with the opposite client.
(3) If the P2P data transmission channel fails to be established, the SFU node and the opposite client terminal are used for carrying out audio and video data transfer communication.
Preferably, the processor 13 is further capable of executing the above program code to implement the following method:
(4) When the establishment of the P2P data transmission channel between the client and the opposite client fails and transfer communication cannot be carried out through the SFU node (namely, no SFU node which can successfully establish the P2P hole data transmission channel with both the client and the opposite client exists), transfer data transmission between the client and the opposite client is carried out through a public network relay server.
The detailed description of the above method is referred to the first embodiment and the second embodiment, and will not be repeated here.
In the electronic device (client) provided in this embodiment, when a P2P data transmission channel cannot be successfully established between the client and the peer client, an attempt is made to perform audio/video data transfer communication through a communication proxy of the SFU node. Since SFU nodes are distributed on the user's devices, bandwidth transmission can be used for free, so bandwidth cost and operation cost can be reduced much compared with the scheme of relay service through a public network relay server. In addition, the more users that are online at the same time, the more devices that can be used as SFU nodes, so that audio and video communication among a large number of users can be supported. When SFU nodes which can successfully establish a P2P data transmission channel with the client and the counterpart client do not exist, the public network relay server is adopted to realize audio and video data transmission between the client and the counterpart client, so that smooth data transmission is ensured.
Fourth embodiment
Referring to fig. 6, a schematic diagram of a data transmission system according to a fourth embodiment of the present invention is shown.
In this embodiment, the data transmission system 1 includes a STUN server 2, an SFU node 3, and at least two clients 4, where the foregoing devices perform data communication through a wired or wireless network. The SFU node 3 is a node in the content distribution network.
In this embodiment, when the P2P audio/video data transmission between two clients 4 (the local client 41 and the remote client 42) is required, the STUN server 2 tries to establish the P2P data transmission channel first. If the P2P data transmission channel is successfully established, the two clients 4 perform audio and video communication through the P2P data transmission channel. If the P2P data transmission channel fails to be established, the two clients 4 perform audio and video data transfer communication through the communication proxy of the SFU node 3. Wherein the SFU node 3 needs to be able to successfully establish a P2P data transmission channel with both clients 4. If the establishment of the P2P data transmission channel between the two clients 4 fails, and there is no SFU node 3 that can successfully establish the P2P data transmission channel with both the two clients 4, the two clients 4 need to perform transfer data transmission through the public network relay server.
The above detailed description of the functions of each device in the data transmission system 1 is referred to the following fifth embodiment and sixth embodiment, and will not be repeated here.
Fifth embodiment
Referring to fig. 7, a fifth embodiment of the present invention proposes a data transmission method applied to the data transmission system 1. In this embodiment, the execution sequence of the steps in the flowchart shown in fig. 7 may be changed, and some steps may be omitted according to different requirements. The method comprises the following steps:
s30, the two clients 4 send a hole punching request to the corresponding STUN server 2 to request to establish a P2P data transmission channel with the other party.
If the P2P audio/video data transmission between the two clients 4 (the local client 41 and the remote client 42) is required, the STUN server 2 first tries to establish a P2P data transmission channel.
Referring to fig. 8, fig. 8 is a detailed flowchart of S30. In this embodiment, the step S30 includes:
s300, the two clients 4 acquire their own extranet IP and port (port) through the STUN server 2 in the nearby area, respectively.
S302, two clients 4 respectively send own external network IP and port to each other through the Internet.
S304, the two clients 4 respectively acquire the external network IP and the port of the other party through the Internet.
S306, the two clients 4 respectively send test data packets to the external network IP and port of the other party to establish a P2P data transmission channel.
After receiving the test data packet sent by the other party, the local client 41 or the remote client 42 timely feeds back an ACK response frame to the other party. As long as at least one of the local client 41 and the remote client 42 receives the ACK response frame fed back by the other party within a preset time, it is determined that the P2P data transmission channel is successfully established. If both the local client 41 and the remote client 42 timeout and do not receive the ACK response frame fed back by the other party, it is determined that the P2P data transmission channel establishment fails.
S32, when the P2P data transmission channel is successfully established, the two clients 4 perform P2P audio and video communication through the P2P data transmission channel.
If the P2P data transmission channel can be established successfully, the local client 41 and the remote client 42 directly send the audio/video data to each other through the P2P data transmission channel.
And S34, when the P2P data transmission channel is failed to be established, the two clients 4 conduct audio and video data transfer communication through the SFU node 3.
If the P2P data transmission channel is failed to be established, other modes need to be used to establish the transmission channel between the local client 41 and the remote client 42. In the present embodiment, the relay communication of the audio and video data between the local client 41 and the remote client 42 is attempted by the communication proxy of the SFU node 3.
Referring to fig. 9, fig. 9 is a detailed flowchart of S34. In this embodiment, the step S34 includes:
s340, selecting the SFU node 3 which can successfully establish the P2P data transmission channel with the two clients 4.
The SFU node 3 requests that both clients 4 can successfully establish a P2P data transmission channel, and if any party fails to hole with the SFU node 3, the SFU node 3 loses the transfer function. When the P2P data transmission channel is failed to be established, SFU nodes 3 capable of P2P data transmission with the two NAT types (the two clients 4 may be the same NAT type or different NAT types) are selected according to the NAT types of the two clients 4, and there may be a plurality of such SFU nodes 3. Then, one of the SFU nodes 3 is selected according to a preset rule (e.g., a nearby rule), the two clients 4 are tried to establish P2P data transmission channels respectively, and if both channels can be successfully established, the SFU node 3 is used as a transfer between the two clients 4. If the establishment of the P2P data transmission channel between any one of the clients 4 and the SFU node 3 fails, the SFU node 3 loses the transfer function, continues to select the next SFU node 3, and tries to establish the P2P data transmission channel with the two clients 4 respectively until the SFU node 3 that can successfully establish the P2P data transmission channel with both the clients 4 is found. If there is no SFU node 3 that can successfully establish a P2P data transmission channel with both the two clients 4, the two clients 4 cannot perform transit communication through the SFU node 3.
S342, the SFU node 3 transfers the audio/video data transmitted by the two clients 4 to each other through the P2P data transmission channel between the SFU node and the two clients 4.
In this embodiment, the local client 41 and the remote client 42 respectively transmit audio and video data to the SFU node 3 through a P2P data transmission channel with the SFU node 3, and then the SFU node 3 transfers the received audio and video data to the P2P data transmission channel with the remote client 42 or the local client 41, thereby implementing audio and video data communication between the local client 41 and the remote client 42.
In the data transmission method provided in this embodiment, since the SFU nodes 3 are distributed on the devices of the user, the bandwidth transmission can be used for free, so that compared with the scheme of performing the relay service through the public network relay server, the bandwidth cost and the operation cost can be reduced greatly. In addition, the more users that are online at the same time, the more devices that can be used as SFU nodes 3, so that audio and video communication between a large number of users can be supported.
Sixth embodiment
Referring to fig. 10, a sixth embodiment of the present invention proposes a data transmission method. In this embodiment, the execution sequence of the steps in the flowchart shown in fig. 10 may be changed, and some steps may be omitted according to different requirements. In this embodiment, S40 to S44 in the above-described data transmission method are similar to S30 to S34 in the sixth embodiment, except that the method further includes S46.
S40, the two clients 4 send a hole punching request to the corresponding STUN server 2 to request to establish a P2P data transmission channel with the other party.
S42, when the P2P data transmission channel is successfully established, the two clients 4 perform P2P audio and video communication through the P2P data transmission channel.
S44, when the P2P data transmission channel fails to be established, the two clients 4 conduct audio and video data transfer communication through the SFU node 3.
S46, when the P2P data transmission channel between the two clients 4 fails to be established and the transfer communication cannot be carried out through the SFU node 3, the two clients 4 do the transfer data transmission through the public network relay server.
If any one of the two clients 4 fails to hole with the SFU node 3, the SFU node 3 loses the transfer function, and at this time, the transfer of the public network relay server is needed to realize the audio and video data transmission between the two clients 4.
The above-described flow is described below with a specific example:
(1) In the same VoIP room, if the user A and the user B can directly establish a P2P data transmission channel through the corresponding STUN server, voIP audio and video data transmission is carried out through the P2P data transmission channel.
(2) If the direct establishment of the P2P data transmission channel between the user A and the user B is unsuccessful, selecting an SFU node capable of successfully establishing the P2P data transmission channel between the user A and the user B according to NAT (Network Address Translation ) types of the user A and the user B.
(3) The SFU node attempts to establish a P2P data transmission channel with user a.
(4) And similarly, the SFU node tries to establish a P2P data transmission channel with the user B.
(5) If the user A or the user B fails to punch holes with the SFU node and cannot establish connection, the user A and the user B do VoIP network transmission through the public network relay server.
(6) If the user A and the user B respectively punch holes with the SFU node successfully, the user A sends the audio and video data to the SFU node through a P2P data transmission channel established with the SFU node.
(7) And the same user B sends the audio and video data to the SFU node through a P2P data transmission channel established with the SFU node.
(8) The SFU node transfers the audio and video data sent by the user A to the user B through a P2P data transmission channel between the SFU node and the user B, and the user B receives the audio and video data sent by the user A.
(9) And similarly, the SFU node transfers the audio and video data sent by the user B to the user A through a P2P data transmission channel between the SFU node and the user A, and the user A receives the audio and video data sent by the user B.
According to the data transmission method provided by the embodiment, when the P2P data transmission channel cannot be successfully established between the two clients 4, the communication proxy of the SFU node 3 is tried to perform audio and video data transfer communication. Since the SFU nodes 3 are distributed on the user's devices, bandwidth transmission can be used for free, and thus bandwidth costs and operation costs can be significantly reduced compared to a scheme of relay service through a public network relay server. In addition, the more users that are online at the same time, the more devices that can be used as SFU nodes 3, so that audio and video communication between a large number of users can be supported. When the SFU node 3 which can successfully establish the P2P data transmission channel with the two clients 4 does not exist, the public network relay server is adopted to realize the audio and video data transmission between the two clients 4, so that the smooth proceeding of the data transmission is ensured.
Seventh embodiment
The present invention also provides another embodiment, namely, a computer-readable storage medium storing a data transmission program 100, where the data transmission program 100 can be executed by at least one processor, so that the at least one processor performs the data transmission method as described above.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a client (which may be a mobile phone, a computer, an electronic device, an air conditioner, or a network equipment, etc.) to perform the method according to the embodiments of the present invention.
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 (11)

1. A data transmission method applied to a client, the method comprising:
acquiring own external network IP and port through the STUN server in the nearby area;
sending own external network IP and port to the opposite side client through the Internet;
acquiring the IP and the port of the opposite client through an Internet network;
sending a test data packet to an external network IP and a port of the opposite side client side, and feeding back an ACK response frame after receiving the test data packet sent by the opposite side client side so as to establish a P2P data transmission channel;
if the P2P data transmission channel is established successfully, P2P audio and video communication is carried out with the opposite client; a kind of electronic device with high-pressure air-conditioning system
If the P2P data transmission channel fails to be established, the selective forwarding unit SFU node and the opposite client side are used for carrying out audio and video data transfer communication.
2. The data transmission method of claim 1, wherein the method further comprises:
and when the establishment of the P2P data transmission channel between the client and the opposite client fails and the transfer communication cannot be carried out through the SFU node, carrying out the transfer data transmission between the client and the opposite client through a public network relay server.
3. The data transmission method as claimed in claim 1 or 2, wherein said performing audio-video data transfer communication with the counterpart client through the SFU node comprises:
selecting the SFU node which can successfully establish a P2P data transmission channel with the client and the opposite client;
the client transmits audio and video data to the SFU node through a P2P data transmission channel between the SFU node and the opposite client so as to transfer the audio and video data to the opposite client through the P2P data transmission channel between the SFU node and the opposite client;
and the client receives the audio and video data transmitted by the opposite client in the SFU node through a P2P data transmission channel between the client and the SFU node.
4. The data transmission method as claimed in claim 3, wherein said selecting said SFU node that can successfully establish a P2P data transmission channel with both said client and said counterpart client comprises:
selecting a plurality of SFU nodes capable of carrying out P2P data transmission with the NAT type according to the NAT type of the network address conversion of the client and the opposite client;
selecting one from the SFU nodes according to a preset rule, attempting to establish a P2P data transmission channel with the client and the opposite client respectively, and taking the SFU node as a transfer between the client and the opposite client if both P2P data transmission channels can be successfully established;
if the establishment of the P2P data transmission channel between the client or the opposite side client and the SFU node fails, continuing to select the next SFU node, and trying to establish the P2P data transmission channel with the client and the opposite side client respectively until the SFU node which can successfully establish the P2P data transmission channel with both the client and the opposite side client is found;
if the SFU node which can successfully establish the P2P data transmission channel with the client and the counterpart client does not exist, the client and the counterpart client can not carry out transfer communication through the SFU node.
5. The data transmission method of claim 1, wherein the SFU node is a node in a content distribution network.
6. An electronic device comprising a memory, a processor, wherein the memory has stored thereon a data transfer program executable on the processor, the data transfer program when executed by the processor implementing the data transfer method of any of claims 1-5.
7. A data transmission system, the system comprising:
STUN server;
a selective forwarding unit SFU node;
at least two clients;
the two clients acquire own external network IP and port through a STUN server in a nearby area, transmit own external network IP and port to the opposite side client through an Internet network, acquire the IP and port of the opposite side client through the Internet network, transmit test data packets to the external network IP and port of the opposite side client, and feed back ACK response frames after receiving the test data packets transmitted by the opposite side client so as to establish a P2P data transmission channel;
if the P2P data transmission channel is established successfully, P2P audio and video communication is carried out between the two clients through the P2P data transmission channel;
if the P2P data transmission channel fails to be established, the two clients conduct audio and video data transfer communication through the SFU node.
8. The data transmission system of claim 7, wherein:
when the establishment of the P2P data transmission channel between the two clients fails and the transfer communication cannot be carried out through the SFU node, the two clients carry out the transfer data transmission through the public network relay server.
9. The data transmission system according to claim 7 or 8, wherein the performing audio-video data transfer communication between the two clients through the SFU node includes:
selecting the SFU node which can successfully establish a P2P data transmission channel with the two clients;
the two clients respectively transmit audio and video data to the SFU node through a P2P data transmission channel between the SFU node and the opposite client so as to transfer the audio and video data to the opposite client through the P2P data transmission channel between the SFU node and the opposite client;
and the two clients respectively receive the audio and video data transmitted by the opposite client transferred by the SFU node through a P2P data transmission channel between the two clients and the SFU node.
10. The data transmission system of claim 7, wherein the SFU node is a node device in a content distribution network.
11. A computer-readable storage medium storing a data transmission program executable by at least one processor to cause the at least one processor to perform the data transmission method according to any one of claims 1-5.
CN201811367118.2A 2018-11-16 2018-11-16 Data transmission method and system, electronic device and computer readable storage medium Active CN109495599B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811367118.2A CN109495599B (en) 2018-11-16 2018-11-16 Data transmission method and system, electronic device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811367118.2A CN109495599B (en) 2018-11-16 2018-11-16 Data transmission method and system, electronic device and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN109495599A CN109495599A (en) 2019-03-19
CN109495599B true CN109495599B (en) 2023-09-19

Family

ID=65695092

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811367118.2A Active CN109495599B (en) 2018-11-16 2018-11-16 Data transmission method and system, electronic device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN109495599B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110177288A (en) * 2019-05-29 2019-08-27 北京大米科技有限公司 Audio/video data transmission method, device, electronic equipment and computer-readable medium
CN110266828A (en) * 2019-06-11 2019-09-20 华为技术有限公司 A kind of method, apparatus and network system for establishing end to end network connection
CN110505270A (en) * 2019-07-03 2019-11-26 西安万像电子科技有限公司 Data transmission method, system and device
CN110730203A (en) * 2019-09-04 2020-01-24 华为技术有限公司 P2P communication method and device
WO2021184225A1 (en) * 2020-03-17 2021-09-23 华为技术有限公司 Communication method and apparatus
CN114915748A (en) * 2021-02-09 2022-08-16 华为技术有限公司 Method, system and related device for dynamically switching audio and video communication modes
CN115686384B (en) * 2022-12-30 2023-04-11 北京探索者软件股份有限公司 Data transmission method and device for CAD client, storage medium and electronic device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101102310A (en) * 2007-07-25 2008-01-09 中国科学院沈阳计算技术研究所有限公司 SIP soft switching system supporting P2P media transmission and its implementation method
WO2010091724A1 (en) * 2009-02-11 2010-08-19 Nokia Siemens Networks Oy Network component and method for operating said network component
US8601144B1 (en) * 2012-11-27 2013-12-03 Sansay, Inc. Systems and methods for automatic ICE relay candidate creation
CN103702062A (en) * 2013-12-27 2014-04-02 Tcl集团股份有限公司 Audio and video communication method, device and system
CN103718532A (en) * 2013-03-26 2014-04-09 华为技术有限公司 Data transmission method, apparatus and terminal device
CN107196838A (en) * 2017-07-20 2017-09-22 韩锐 Communication means and system based on transnational, the ultralow delay of video class in webpage

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7483393B2 (en) * 2004-12-07 2009-01-27 Cisco Technology, Inc. Method and apparatus for discovering internet addresses
US9762508B2 (en) * 2014-10-02 2017-09-12 Microsoft Technology Licensing, Llc Relay optimization using software defined networking
US9871922B1 (en) * 2016-07-01 2018-01-16 At&T Intellectual Property I, L.P. Customer care database creation system and method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101102310A (en) * 2007-07-25 2008-01-09 中国科学院沈阳计算技术研究所有限公司 SIP soft switching system supporting P2P media transmission and its implementation method
WO2010091724A1 (en) * 2009-02-11 2010-08-19 Nokia Siemens Networks Oy Network component and method for operating said network component
US8601144B1 (en) * 2012-11-27 2013-12-03 Sansay, Inc. Systems and methods for automatic ICE relay candidate creation
CN103718532A (en) * 2013-03-26 2014-04-09 华为技术有限公司 Data transmission method, apparatus and terminal device
CN103702062A (en) * 2013-12-27 2014-04-02 Tcl集团股份有限公司 Audio and video communication method, device and system
CN107196838A (en) * 2017-07-20 2017-09-22 韩锐 Communication means and system based on transnational, the ultralow delay of video class in webpage

Also Published As

Publication number Publication date
CN109495599A (en) 2019-03-19

Similar Documents

Publication Publication Date Title
CN109495599B (en) Data transmission method and system, electronic device and computer readable storage medium
CN109660637B (en) P2P hole punching transmission method and system, electronic device and computer readable storage medium
US9124608B2 (en) Conveying session continuity information in a multi-component communication session
KR101106926B1 (en) Submit report handling in smsip
US8130671B2 (en) Method and system for establishing bidirectional tunnel
US7542481B2 (en) Connection optimization for communications in multiple access environment
EP2905944A1 (en) Webpage real-time communication method and system, and terminal
US7697471B2 (en) Address translation in a communication system
US20110258682A1 (en) Method, apparatus, and system for processing session context
US8244258B2 (en) VoIP communication control method and access point apparatus
US20050015499A1 (en) Method and apparatus for SIP user agent discovery of configuration server
CN113206894B (en) Method and device for discovering DNS server, computer equipment and storage medium
CN107786509B (en) Session message processing method and related device
CN112261336B (en) Method for realizing mobile phone video communication by fusing GB28181 protocol
WO2013189398A2 (en) Application data push method, device, and system
EP3796595B1 (en) Dect network clustering system and clustering method
WO2015070377A1 (en) Multiparty call method and apparatus
KR101224225B1 (en) Submit report handling in smsip
EP3264852A1 (en) Method for allocating ip address in d2d communication, and user equipment
CN111294327A (en) Message conflict resolution method and terminal equipment
US20050086327A1 (en) Method and apparatus by which a UE starts compression in SIP signalling to IMS
US20170311135A1 (en) Control Signaling Transmission Method in MCPTT Architecture and Related Device
KR102396634B1 (en) Apparatus and method for transmitting of message reception information in wireless communication system
JP5570392B2 (en) Retransmission request transmission protocol converter
CN114466008B (en) Cloud edge communication system, cloud edge communication method, cloud edge communication device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant