CN116846948A - Control method for establishing direct link, direct link establishing method and related device - Google Patents

Control method for establishing direct link, direct link establishing method and related device Download PDF

Info

Publication number
CN116846948A
CN116846948A CN202210298786.4A CN202210298786A CN116846948A CN 116846948 A CN116846948 A CN 116846948A CN 202210298786 A CN202210298786 A CN 202210298786A CN 116846948 A CN116846948 A CN 116846948A
Authority
CN
China
Prior art keywords
terminal
internet protocol
address
server
policy
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210298786.4A
Other languages
Chinese (zh)
Inventor
薛政
周煜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202210298786.4A priority Critical patent/CN116846948A/en
Publication of CN116846948A publication Critical patent/CN116846948A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • 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
    • 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/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer And Data Communications (AREA)

Abstract

The embodiment of the application discloses a control method for establishing a direct link, a method for establishing the direct link and a related device, which are applied to a vehicle-mounted scene, wherein the method comprises the following steps: the first terminal sends a first internet protocol stack type to the first server, and the second terminal sends a second internet protocol stack type to the first server; and the first server determines a target penetration strategy corresponding to a target Internet protocol supported by both the first terminal and the second terminal according to the first Internet protocol stack type and the second Internet protocol stack type, and sends the target penetration strategy to the first terminal and the second terminal. The first terminal determines a first address corresponding to the target penetration strategy and sends the first address to the first server, and the second terminal determines a first address corresponding to the target penetration strategy and sends the first address to the first server; the first server sends a second address to the first terminal and sends a first address to the second terminal; the first terminal is based on the second address, the second terminal is based on the bidirectional penetration of the first address, and a direct link is established between the first terminal and the second terminal.

Description

Control method for establishing direct link, direct link establishing method and related device
Technical Field
The present application relates to the field of data transmission technologies, and in particular, to a control method for establishing a direct link, a method for establishing a direct link, and a related device.
Background
With the development of terminal technology and the improvement of network bandwidth, the data volume transmitted between terminals through a network is larger and larger, and the requirements on transmission capacity are higher and higher. The data transmission between the terminals is divided into transfer transmission and direct connection transmission, and compared with the transfer transmission, the direct connection transmission does not need to additionally arrange a transfer server, so that the cost and the resources are saved; the direct connection transmission can avoid the attack of the intermediate node, and the security and confidentiality of data transmission are improved; therefore, direct connection transmission between terminals is widely applied and particularly important.
In the related art, two terminals of data transmission establish sockets, obtain corresponding external network addresses for address exchange, send data packets to external network addresses of opposite terminals through the same socket, after a certain terminal receives the data packets sent by the opposite terminals, change destination addresses of the data packets into previous source addresses, and continue to send the data packets to the opposite terminals until each terminal of the two terminals receives the data packets sent by the opposite terminals to establish a direct link, and then the two subsequent terminals perform direct link transmission through the direct link.
The direct transmission between terminals depends on the establishment of a direct link, and whether the direct link can be established in relation to the internet protocol supported by both terminals complicates the internet protocol supported by both terminals with the development of internet protocol version 4 (Internet Protocol version, ipv 4) to internet protocol version 6 (Internet Protocol version, ipv 6). However, the above method is only applicable to the case where both terminals support the internet protocol of IPv4, and cannot cope with the case where both terminals support the internet protocol of complexity.
Disclosure of Invention
In order to solve the technical problems, the application provides a control method for establishing a direct link, a method for establishing a direct link and a related device, and the method can effectively establish the direct link between two terminals even under the condition that internet protocols supported by the two terminals are complicated, so that the success rate and the efficiency of establishing the direct link are improved.
The embodiment of the application discloses the following technical scheme:
in one aspect, the present application provides a control method for establishing a direct link, which is applied to a first server, and the method includes:
receiving a first internet protocol stack type sent by a first terminal and a second internet protocol stack type sent by a second terminal; the first internet protocol stack type is determined by an internet protocol supported by the first terminal, and the second internet protocol stack type is determined by an internet protocol supported by the second terminal;
Determining a target penetration strategy corresponding to a target internet protocol according to the first internet protocol stack type and the second internet protocol stack type; the target internet protocol is an internet protocol supported by both the first terminal and the second terminal;
transmitting the target penetration policy to the first terminal and the second terminal;
receiving a first address of the first terminal corresponding to the target penetration policy and a second address of the second terminal corresponding to the target penetration policy;
the second address is sent to the first terminal, and the first address is sent to the second terminal; so that the first terminal penetrates in two directions based on the second address and the second terminal penetrates in two directions based on the first address until a direct connection link is established between the first terminal and the second terminal.
In another aspect, the present application provides a method for establishing a direct link, applied to a first terminal, where the method includes:
transmitting a first internet protocol stack type to a first server; the first internet protocol stack type is determined by an internet protocol supported by the first terminal;
receiving a target penetration strategy of a corresponding target Internet protocol sent by the first server; the target penetration policy is determined by the first server according to the first internet protocol stack type and a second internet protocol stack type sent by a second terminal, the second internet protocol stack type is determined by an internet protocol supported by the second terminal, and the target internet protocol is an internet protocol supported by both the first terminal and the second terminal;
Determining a first address corresponding to the target penetration policy;
transmitting the first address to the first server; so that the first server sends the first address to the second terminal, and the second terminal penetrates through to the first terminal based on the first address;
receiving a second address, corresponding to the target penetration policy, of the second terminal, which is sent by the first server;
and penetrating the second terminal based on the second address until a direct link is established between the first terminal and the second terminal.
In another aspect, the present application provides a control device for establishing a direct link, applied to a first server, where the device includes: a first receiving unit, a first determining unit, a first transmitting unit, a second receiving unit and a second transmitting unit;
the first receiving unit is configured to receive a first internet protocol stack type sent by a first terminal and a second internet protocol stack type sent by a second terminal; the first internet protocol stack type is determined by an internet protocol supported by the first terminal, and the second internet protocol stack type is determined by an internet protocol supported by the second terminal;
the first determining unit is configured to determine a target penetration policy corresponding to a target internet protocol according to the first internet protocol stack type and the second internet protocol stack type; the target internet protocol is an internet protocol supported by both the first terminal and the second terminal;
The first sending unit is configured to send the target penetration policy to the first terminal and the second terminal;
the second receiving unit is configured to receive a first address of the first terminal corresponding to the target penetration policy and a second address of the second terminal corresponding to the target penetration policy;
the second sending unit is configured to send the second address to the first terminal and send the first address to the second terminal; so that the first terminal penetrates in two directions based on the second address and the second terminal penetrates in two directions based on the first address until a direct connection link is established between the first terminal and the second terminal.
In another aspect, the present application provides a direct link establishment apparatus, applied to a first terminal, including: a third transmitting unit, a third receiving unit, a second determining unit, a fourth transmitting unit, a fourth receiving unit and an establishing unit;
the third sending unit is configured to send a first internet protocol stack type to a first server; the first internet protocol stack type is determined by an internet protocol supported by the first terminal;
the third receiving unit is configured to receive a target penetration policy corresponding to a target internet protocol sent by the first server; the target penetration policy is determined by the first server according to the first internet protocol stack type and a second internet protocol stack type sent by a second terminal, the second internet protocol stack type is determined by an internet protocol supported by the second terminal, and the target internet protocol is an internet protocol supported by both the first terminal and the second terminal;
The second determining unit is used for determining a first address corresponding to the target penetration strategy;
the fourth sending unit is configured to send the first address to the first server; so that the first server sends the first address to the second terminal, and the second terminal penetrates through to the first terminal based on the first address;
the fourth receiving unit is configured to receive a second address, corresponding to the target penetration policy, of the second terminal, where the second address is sent by the first server;
the establishing unit is configured to penetrate through to the second terminal based on the second address until a direct link is established between the first terminal and the second terminal.
In another aspect, the application provides a computer device comprising a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to execute the control method for establishing a direct link according to the above aspect or the direct link establishment method according to the above aspect according to an instruction in the program code.
In another aspect, an embodiment of the present application provides a computer readable storage medium, where the computer readable storage medium is configured to store a computer program, where the computer program is configured to execute the control method for establishing a direct link described in the above aspect, or the direct link establishing method described in the above aspect.
In another aspect, embodiments of the present application provide a computer program product comprising a computer program or instructions; the control method of direct link establishment as described in the above aspect or the direct link establishment method as described in the above aspect is performed when the computer program or instructions are executed by a processor.
According to the technical scheme, the first terminal sends a first internet protocol stack type determined by the internet protocol supported by the first terminal to the first server, and the second terminal sends a second internet protocol stack type determined by the internet protocol supported by the second terminal to the first server; and the first server determines a target penetration strategy corresponding to a target Internet protocol supported by both the first terminal and the second terminal according to the first Internet protocol stack type and the second Internet protocol stack type, and sends the target penetration strategy to the first terminal and the second terminal. The first terminal determines a first address corresponding to the target penetration strategy and sends the first address to the first server, and the second terminal determines a first address corresponding to the target penetration strategy and sends the first address to the first server; the first server sends a second address to the first terminal and sends a first address to the second terminal; the first terminal is based on the second address and the second terminal is based on the first address to penetrate in two directions until a direct link is established between the first terminal and the second terminal.
The server collects the internet protocol supported by both terminals, adaptively selects the penetration strategy corresponding to the internet protocol supported by both terminals, and exchanges the address of the penetration strategy corresponding to both terminals, so as to establish a direct link between both terminals through bidirectional penetration. Based on this, even in the case that the internet protocol supported by both terminals is complicated, the method can effectively establish the direct link between both terminals, thereby improving the success rate and efficiency of establishing the direct link.
Drawings
In order to more clearly illustrate the embodiments of the application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the application, and that other drawings may be obtained from these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic application scenario diagram of a direct link establishment method according to an embodiment of the present application;
fig. 2 is a signaling interaction diagram of a direct link establishment method according to an embodiment of the present application;
Fig. 3 is an application scenario architecture diagram of a direct link establishment method according to an embodiment of the present application;
fig. 4 is a schematic diagram of bidirectional penetration of a first terminal and a second terminal according to an embodiment of the present application;
fig. 5 is a schematic diagram of penetration of a first terminal to a second terminal according to an embodiment of the present application;
fig. 6 is a signaling interaction diagram of an application method for establishing a direct link according to an embodiment of the present application;
fig. 7 is a schematic diagram of a control device for establishing a direct link according to an embodiment of the present application;
fig. 8 is a schematic diagram of a direct link establishment apparatus according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a server according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a terminal device according to an embodiment of the present application.
Detailed Description
Embodiments of the present application are described below with reference to the accompanying drawings.
In the related technology, a socket is established between a terminal A and a terminal B, address exchange is carried out after the terminal A acquires an external network address and the terminal B acquires the external network address, the terminal A sends a data packet to the external network address of the terminal B through the socket, and the terminal B sends the data packet to the external network address of the terminal A through the socket; after receiving the data packet sent by the opposite terminal, a certain terminal changes the destination address of the data packet into the previous source address, and continues to send the data packet to the opposite terminal until the terminal A receives the data packet of the terminal B and the terminal B receives the data packet of the terminal A to establish a direct link, and the subsequent terminals A and B perform direct transmission through the direct link.
Through research, it is found that direct connection transmission between terminals depends on establishment of a direct connection link, and whether the direct connection link can be established is related to an internet protocol supported by both terminals, and along with development of IPv4 to IPv6, the internet protocol supported by both terminals is complicated. However, the above method is only applicable to the case where both terminals support the internet protocol of IPv4, and cannot cope with the case where both terminals support the internet protocol of complexity; and in the case that both terminals support the internet protocol including the IPv6, the resources corresponding to the IPv6 cannot be utilized.
In view of this, the present application proposes a control method for establishing a direct link, a method for establishing a direct link, and a related device, in which a server collects internet protocols supported by both terminals, adaptively selects a penetration policy corresponding to the internet protocols supported by both terminals, and exchanges addresses of the penetration policies corresponding to both terminals, so as to establish a direct link between both terminals through bidirectional penetration. Based on this, even in the case that the internet protocol supported by both terminals is complicated, the method can effectively establish the direct link between both terminals, thereby improving the success rate and efficiency of establishing the direct link.
The control method for establishing the direct link provided by the embodiment of the application can be applied to control equipment for establishing the direct link with data processing capability, such as a server, etc., wherein the server can be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server for providing cloud computing service, but is not limited to the above.
The method for establishing the direct link provided by the embodiment of the application can be applied to direct link establishment equipment with data processing capacity, such as terminal equipment and the like; the terminal equipment comprises, but is not limited to, a mobile phone, a tablet, a computer, an intelligent camera, intelligent voice interaction equipment, intelligent household appliances, a vehicle-mounted terminal, an aircraft and the like. The terminal device and the server may be directly or indirectly connected through wired or wireless communication, and the present application is not limited herein.
The control method for establishing the direct link and the method for establishing the direct link provided by the embodiment of the application are characterized in that the first terminal and the second terminal can be used as nodes in a block chain, and related transmission data can be stored in the block chain.
In order to facilitate understanding of the technical scheme of the present application, the control method for establishing a direct link and the method for establishing a direct link provided by the embodiments of the present application are described below in conjunction with practical application scenarios.
Referring to fig. 1, fig. 1 is a schematic application scenario diagram of a direct link establishment method according to an embodiment of the present application. The application scenario shown in fig. 1 includes a first terminal 101, a first server 102, and a second terminal 103; in the end-to-end direct connection transmission scenario, only a routing node is arranged on a transmission link, no transit server node is arranged, the transmission cost is low, and the method is suitable for large-data-volume data transmission, such as file data transmission, video data transmission, audio-video call data transmission, live broadcast data transmission, virtual reality data transmission and the like; in addition, the method has higher security and confidentiality, and is also widely applicable to block chain data transmission.
The first terminal 101 sends a first internet protocol stack type to the first server 102, the first internet protocol stack type being determined by the internet protocol supported by the first terminal 101; the second terminal 103 sends a second internet protocol stack type to the first server 102, the second internet protocol stack type being determined by the internet protocol supported by the second terminal 103. For example, the first internet protocol stack type may be an IPv4 single stack, an IPv6 single stack, or an IPv4/IPv6 dual protocol stack, and the second internet protocol stack type may be an IPv4 single stack, an IPv6 single stack, or an IPv4/IPv6 dual protocol stack.
The first server 102 determines a target penetration policy corresponding to the target internet protocol according to the first internet protocol stack type and the second internet protocol stack type; the target internet protocol is an internet protocol supported by both the first terminal 101 and the second terminal 103. For example, in the case that the first internet protocol stack type and the second internet protocol stack type are both IPv4/IPv6 dual stacks, the target internet protocol is IPv4 and IPv6, and the target penetration policy is determined to be an IPv4 penetration policy and an IPv6 penetration policy.
For another example, in the case that the first internet protocol stack type and the second internet protocol stack type are both IPv4 single stacks, the first internet protocol stack type is IPv4 single stacks, the second internet protocol stack type is IPv4/IPv6 dual stacks, the first internet protocol stack type is IPv4/IPv6 dual stacks, and the second internet protocol stack type is IPv4 single stacks, the target internet protocol is IPv4, and the target penetration policy is determined to be an IPv4 penetration policy.
For another example, when the first internet protocol stack type and the second internet protocol stack type are both IPv6 single stacks, the first internet protocol stack type is IPv6 single stacks, the second internet protocol stack type is IPv4/IPv6 dual stacks, the first internet protocol stack type is IPv4/IPv6 dual stacks, and the second internet protocol stack type is IPv6 single stacks, the target internet protocol is IPv6, and the target penetration policy is determined to be an IPv6 penetration policy.
The first server 102 sends the target penetration policy to the first terminal 101 and the second terminal 103.
The first terminal 101 determines a first address corresponding to the target penetration policy; the second terminal 103 determines a second address corresponding to the target penetration policy. For example, the target penetration policy is an IPv4 penetration policy and an IPv6 penetration policy, the first address is an IPv4 external network address and an IPv6 local address of the first terminal 101, and the second address is an IPv4 external network address and an IPv6 local address of the second terminal 103; for another example, the target penetration policy is an IPv4 penetration policy, the first address is an IPv4 extranet address of the first terminal 101, and the second address is an IPv4 extranet address of the second terminal 103; for another example, the target penetration policy is an IPv6 penetration policy, the first address is an IPv6 local address of the first terminal 101, and the second address is an IPv6 local address of the second terminal 103.
The first terminal 101 transmits a first address to the first server 102; the second terminal 103 sends the second address to the first server 102.
The first server 102 transmits the second address to the first terminal 101 and the first address to the second terminal 103.
The first terminal 101 penetrates bi-directionally based on the second address and the second terminal 103 penetrates bi-directionally based on the first address until a direct link is established between the first terminal 101 and the second terminal 103.
As can be seen, the first server 102 collects the internet protocol supported by the first terminal 101 and the internet protocol supported by the second terminal 103, and adaptively selects a target penetration policy corresponding to the target internet protocol supported by both the first terminal 101 and the second terminal 103; the first server 102 exchanges a first address of the first terminal 101 corresponding to the target penetration policy and a second address of the second terminal 103 corresponding to the target penetration policy, the first terminal 101 penetrates through the second address and the second terminal 103 through the first address in a bidirectional manner, and a direct link is established between the first terminal 101 and the second terminal 103. Based on this, even in the case that the internet protocol supported by the first terminal 101 and the internet protocol supported by the second terminal 103 are complicated, the method can effectively perform the establishment of the direct link between the first terminal 101 and the second terminal 103, thereby improving the success rate and efficiency of the establishment of the direct link.
Next, a control method for establishing a direct link and a method for establishing a direct link provided by the embodiment of the application will be specifically described from the aspect of interaction between a first terminal, a second terminal and a first server.
Referring to fig. 2, the diagram is a signaling interaction diagram of a direct link establishment method according to an embodiment of the present application. As shown in fig. 2, the direct link establishment method includes the following steps:
S201: the first terminal sends a first Internet protocol stack type to a first server; the first internet protocol stack type is determined by an internet protocol supported by the first terminal; the second terminal sends a second Internet protocol stack type to the first server; the second internet protocol stack type is determined by an internet protocol supported by the second terminal.
Because the direct connection transmission between the terminals depends on the establishment of a direct connection link, whether the direct connection link can be established or not is related to the Internet protocol supported by both terminals, along with the development of IPv4 to IPv6, the Internet protocol supported by both terminals is complicated; the establishment mode of the direct link in the related art is only suitable for the case that the internet protocols supported by both terminals are IPv4, and cannot cope with the case that the internet protocols supported by both terminals are complicated; and in the case that both terminals support the internet protocol including the IPv6, the resources corresponding to the IPv6 cannot be utilized.
Therefore, in the embodiment of the application, the server is considered to collect the internet protocols supported by both terminals respectively, so that the penetration strategy corresponding to the internet protocols supported by both terminals can be selected adaptively based on the internet protocols, and the direct link between both terminals is established by the bidirectional penetration, so that the situation of complicating the internet protocols supported by both terminals is solved, and resources corresponding to the internet protocols supported by both terminals are not wasted.
That is, on the basis of interaction among the first terminal, the second terminal and the first server, the first terminal transmits a first internet protocol stack type determined by an internet protocol supported by the first terminal to the first server; similarly, the second terminal sends the second internet protocol stack type determined by the internet protocol supported by the second terminal to the first server. The first internet protocol stack type may be, for example, obtained by the first terminal invoking a system network interface; similarly, the second internet protocol stack type may be, for example, specifically, acquired by the second terminal invoking the system network interface, where interoperability between different internet protocol stack types is different.
In addition, the first server may also be a policy server, so this representation is not described in detail later.
In the embodiment of the present application, when the internet protocol supported by the first terminal is a first internet protocol, the first internet protocol stack type is a first internet protocol single stack; when the Internet protocol supported by the first terminal is a second Internet protocol, the first Internet protocol stack type is a second Internet protocol single stack; when the internet protocol supported by the first terminal is the first internet protocol and the second internet protocol, the first internet protocol stack type is a first internet protocol/second internet protocol dual stack. Wherein the first internet protocol/second internet protocol dual stack comprises a protocol stack of the first internet protocol and a protocol stack of the second internet protocol.
Similarly, when the internet protocol supported by the second terminal is the first internet protocol, the second internet protocol stack type is the first internet protocol single stack; when the internet protocol supported by the second terminal is a second internet protocol, the second internet protocol stack type is a second internet protocol single stack; when the internet protocol supported by the second terminal is the first internet protocol and the second internet protocol, the second internet protocol stack type is the first internet protocol/second internet protocol dual stack.
As an example, the first internet protocol may be IPv4, for example, and the second internet protocol may be IPv6, for example; the first internet protocol single stack is an IPv4 single stack, the second internet protocol single stack is an IPv6 single stack, and the first internet protocol/second internet protocol dual stack is an IPv4/IPv6 dual stack. The IPv4/IPv6 dual stack includes an IPv4 protocol stack and an IPv6 protocol stack, and since IPv4 uses a 32-bit (4-byte) address, only 4,294,967,296 (232) addresses exist in an address space, and as the addresses are continuously allocated to the device, the problem of exhaustion of the IPv4 addresses is also generated, and IPv6 is mainly used for solving the problem of exhaustion of the IPv4 addresses.
S202: the first server determines a target penetration strategy corresponding to a target Internet protocol according to the first Internet protocol stack type and the second Internet protocol stack type; the target internet protocol is an internet protocol supported by both the first terminal and the second terminal.
Because the socket corresponding to the IPv4 of one terminal in the two terminals is bound to the IPv4 local address, the data packet is sent to the IPv6 local address of the other terminal through the socket corresponding to the IPv4, and the corresponding routing rule cannot be found due to the fact that the IPv4 and the IPv6 are different, so that packet sending failure is caused, and the establishment of the direct link cannot be penetrated. Similarly, a socket corresponding to IPv6 of a certain terminal in the two terminals is bound to an IPv6 local address, a data packet is sent to an IPv4 external network address of the opposite terminal through the socket corresponding to IPv6, and the corresponding routing rule cannot be found due to the fact that IPv4 and IPv6 are different, so that packet sending fails and direct link establishment cannot be penetrated.
Therefore, in the embodiment of the application, for both terminals, only the penetration strategy corresponding to the internet protocol supported by both terminals is selected, and the subsequent terminals can establish the direct link between both terminals based on the penetration strategy in a bidirectional penetration manner.
That is, the first terminal transmits the first internet protocol stack type to the first server and the second terminal transmits the second internet protocol stack type to the first server corresponding to S201; the first server receives a first internet protocol stack type sent by the first terminal and a second internet protocol stack type sent by the second terminal. On the basis, the first server can determine that the internet protocol supported by the first terminal and the second terminal is the target internet protocol through the first internet protocol stack type and the second internet protocol stack type, so that the penetration strategy corresponding to the target internet protocol is determined to be the target penetration strategy.
In the embodiment of the present application, in the case that the first internet protocol stack type and the second internet protocol stack type are both the first internet protocol/second internet protocol dual stack, the target internet protocol is the first internet protocol and the second internet protocol, and the target penetration policy is determined to be the first internet protocol penetration policy and the second internet protocol penetration policy.
Or, in the case that the first internet protocol stack type and the second internet protocol stack type are both a first internet protocol single stack, the first internet protocol stack type is a first internet protocol single stack and the second internet protocol stack type is a first internet protocol/second internet protocol double stack, the first internet protocol stack type is a first internet protocol/second internet protocol double stack and the second internet protocol stack type is a first internet protocol single stack, the target internet protocol is a first internet protocol, and the target penetration policy is determined to be a first internet protocol penetration policy.
Or, in the case that the first internet protocol stack type and the second internet protocol stack type are both the second internet protocol single stack, the first internet protocol stack type is the second internet protocol single stack and the second internet protocol stack type is the first internet protocol/second internet protocol double stack, the first internet protocol stack type is the first internet protocol/second internet protocol double stack and the second internet protocol stack type is the second internet protocol single stack, the target internet protocol is the second internet protocol, and the target penetration policy is determined to be the second internet protocol penetration policy.
As an example, on the basis of the above example, since the first internet protocol is IPv4, the second internet protocol is IPv6; the first internet protocol penetration policy is an IPv4 penetration policy and the second internet protocol penetration policy is an IPv6 penetration policy. That is, the relationship of the first internet protocol stack type, the second internet protocol stack type, and the target penetration policy is shown below:
in practical applications, the penetration policy may also be referred to as a hole-punching policy, and the target penetration policy is a target hole-punching policy, the first internet protocol penetration policy may also be referred to as a first internet protocol hole-punching policy, and the second internet protocol penetration policy may also be referred to as a second internet protocol hole-punching policy. When the first internet protocol is IPv4 and the second internet protocol is IPv6, the first internet protocol hole-punching strategy is an IPv4 hole-punching strategy, and the second internet protocol hole-punching strategy is an IPv6 hole-punching strategy; this means that the following description is omitted.
Furthermore, considering that the target internet protocol is the first internet protocol and the second internet protocol, or that the target internet protocol is the first internet protocol, that is, that the target internet protocol includes the first internet protocol, the first terminal and the second terminal actually need to penetrate through the external network address under the first internet protocol; the external network address is obtained by converting the local address by a server providing the external network address service of the two terminals, and the server is determined by the information of the service end of the two terminals.
In the embodiment of the present application, when S201 is specifically implemented, in the case that the target internet protocol includes the first internet protocol, on the basis that the first terminal sends the first internet protocol stack type to the first server in S201, the first terminal needs to send the information of the server to which the first terminal belongs, that is, the first server information, to the first server; similarly, on the basis that the second terminal sends the second internet protocol stack type to the first server in S201, the second terminal needs to send the information of the server to which the second terminal belongs, that is, the second server information, to the first server. Thus, the present application provides one possible implementation, S201 may for example comprise: the method comprises the steps that a first terminal sends a first Internet protocol stack type and first server information to a first server, wherein the first server information is information of a server to which the first terminal belongs; the second terminal sends a second internet protocol stack type and second server information to the first server, wherein the second server information is information of a server to which the second terminal belongs.
The first server information may be, for example, obtained by the first terminal invoking a system network interface; similarly, the second server information may be, for example, obtained by the second terminal invoking a system network interface.
As an example, the first server information may be, for example, first operator information, where the first operator information is information of an operator to which the first terminal belongs; similarly, the second server information may be, for example, second operator information, where the second operator information is information of an operator to which the second terminal belongs. The operators may be classified into, for example, operator a, operator B, and operator C, etc.
S203: the first server sends a target penetration policy to the first terminal and the second terminal.
In the embodiment of the present application, after the first server determines the target penetration policy in S202, the target penetration policy needs to be sent to the first terminal and the second terminal, so that the subsequent first terminal and the second terminal can perform the establishment of the direct link between the two terminals based on the penetration policy bidirectional penetration.
In the embodiment of the present application, the target internet protocol includes a first internet protocol, and the target penetration policy includes a first internet protocol penetration policy; corresponding to the implementation of S201, when S203 is implemented, after receiving the first server information sent by the first terminal and the second server information sent by the second terminal, the first server needs to determine the network address of the second server through the first server information and the second server information; the second server supports a first Internet protocol and is used for providing a first Internet protocol external network address service for acquiring a first terminal and a first Internet protocol external network address service for acquiring a second terminal; then, the first server needs to send the network address of the second server to the first terminal and the second terminal on the basis of the first internet protocol penetration policy sent by the first server to the first terminal and the second terminal. Thus, the present application provides one possible implementation, S203 may include, for example, the following S2031-S2032:
S2031: the first server determines the network address of the second server according to the first server information and the second server information; the second server supports the first internet protocol.
S2032: the first server sends a first internet protocol penetration policy and a network address to the first terminal and the second terminal.
As an example, the first internet protocol may be IPv4, and the first internet protocol penetration policy is an IPv4 penetration policy, and the second server is configured to obtain an IPv4 external network address service of the first terminal and an IPv4 external network address service of the second terminal, where the second server supports IPv4, and may be an IPv4 single stack server that deploys a network address translation session traversal application (Session Traversal Utilities for NAT, STUN).
The second server may also be referred to as a hole punching server, so that the following description is omitted.
The STUN is a network protocol that allows a terminal located behind a network address translation (Network Address Translation, NAT) router to find out the external network address of the terminal, to find out which type of NAT router is located behind and to which NAT router is bound for a certain local port of the terminal. NAT is a technique for rewriting a source internet protocol address or a destination internet protocol address when a packet passes through a router or a firewall, which can solve the problem of address shortage of lPv4, and can effectively avoid attacks from outside the network, conceal and protect computers inside the network.
S204: the first terminal determines a first address corresponding to a target penetration strategy; the second terminal determines a second address corresponding to the target penetration policy.
In the embodiment of the present application, a first server sends a target penetration policy to a first terminal and a second terminal corresponding to S203; the first terminal receives the target penetration strategy sent by the first server, and the second terminal receives the target penetration strategy sent by the first server. On the basis, the first terminal can determine the address of the first terminal corresponding to the target internet protocol through the target internet protocol corresponding to the target penetration strategy, and the address is used as the first address of the first terminal corresponding to the target penetration strategy; similarly, the second terminal may determine, through the target internet protocol corresponding to the target penetration policy, an address of the second terminal corresponding to the target internet protocol as a second address of the second terminal corresponding to the target penetration policy.
In the embodiment of the present application, the target ip is a first ip penetration policy and a second ip penetration policy under the condition that the target ip is the first ip and the second ip; since the first terminal and the second terminal are penetrated through the external network address under the first internet protocol and the first terminal and the second terminal are penetrated through the local address under the second internet protocol, the first address is the first internet protocol external network address and the second internet protocol local address of the first terminal, and the second address is the first internet protocol external network address and the second internet protocol local address of the second terminal.
Or, in the case that the target internet protocol is the first internet protocol, the target penetration policy is the first internet protocol penetration policy; referring to the above description, the first address is a first internet protocol extranet address of the first terminal, and the second address is a first internet protocol extranet address of the second terminal;
or, in the case that the target internet protocol is the second internet protocol, the target penetration policy is the second internet protocol penetration policy; referring to the above description, the first address is a second internet protocol local address of the first terminal, and the second address is a second internet protocol local address of the second terminal.
In the embodiment of the present application, when the target internet protocol includes the first internet protocol, the target penetration policy includes the first internet protocol penetration policy; corresponding to the implementation manner of S203, in the implementation manner of S204, on the basis that the first terminal receives the first internet protocol penetration policy and the network address sent by the first server, the second terminal receives the first internet protocol penetration policy and the network address sent by the first server, the first terminal may obtain the first internet protocol extranet address of the first terminal from the second server corresponding to the network address based on the first internet protocol penetration policy; similarly, the second terminal may obtain the first internet protocol extranet address of the second terminal from the second server corresponding to the network address based on the first internet protocol penetration policy.
Thus, the present application provides one possible implementation, S204 may include, for example: the first terminal obtains a first Internet protocol external network address of the first terminal from a second server according to a first Internet protocol penetration strategy and a network address; the second terminal obtains a first internet protocol extranet address of the second terminal from the second server according to the first internet protocol penetration strategy and the network address.
In practical application, the first internet protocol penetration policy corresponds to the first internet protocol, and first, the first terminal needs to create a socket corresponding to the first internet protocol and bind to a first internet protocol local address of the first terminal; then, the first terminal needs to send a first data packet to a second server corresponding to the network address through a socket corresponding to the first Internet protocol, and the source address of the first data packet is the first Internet protocol local address of the first terminal; and finally, the second server performs network address conversion on the first Internet protocol local address of the first terminal to obtain a first Internet protocol external network address of the first terminal, and the first terminal acquires the first Internet protocol external network address of the first terminal by changing the source address of the first data packet into the first Internet protocol external network address of the first terminal and sending the first Internet protocol external network address of the first terminal to the first terminal.
Similarly, the second terminal needs to create a socket corresponding to the first internet protocol and bind to the first internet protocol local address of the second terminal; then, the second terminal needs to send a third data packet to a second server corresponding to the network address through a socket corresponding to the first Internet protocol, and the source address of the third data packet is the first Internet protocol local address of the second terminal; and finally, the second server performs network address conversion on the first Internet protocol local address of the second terminal to obtain a first Internet protocol external network address of the second terminal, and the second terminal acquires the first Internet protocol external network address of the second terminal by changing the source address of the third data packet to the first Internet protocol external network address of the second terminal and transmitting the first Internet protocol external network address of the second terminal to the second terminal.
Thus, the present application provides one possible implementation, S204 may include, for example, the following S2041-S2046:
s2041: the first terminal creates a socket corresponding to the first Internet protocol according to the first Internet protocol penetration policy, and binds to a first Internet protocol local address of the first terminal.
S2042: and the first terminal sends a first data packet to the second server through a socket corresponding to the first Internet protocol according to the network address, and the source address of the first data packet is the first Internet protocol local address of the first terminal.
S2043: the first terminal receives a first internet protocol external network address of the first terminal sent by the second server, wherein the first internet protocol external network address of the first terminal is obtained by converting a network address of a first internet protocol local address of the first terminal by the second server.
S2044: the second terminal creates a socket corresponding to the first Internet protocol according to the first Internet protocol penetration strategy and binds to a first Internet protocol local address of the second terminal.
S2045: and the second terminal sends a third data packet to the second server through a socket corresponding to the first Internet protocol according to the network address, and the source address of the third data packet is the first Internet protocol local address of the second terminal.
S2046: the second terminal receives a first internet protocol external network address of the second terminal sent by the second server, wherein the first internet protocol external network address of the second terminal is obtained by converting a network address of a first internet protocol local address of the second terminal by the second server.
In practical applications, the execution order between S2041-S2043 and S2044-S2046 is not limited, and S2041-S2043 and S2044-S2046 may be executed simultaneously, S2041-S2043 may be executed first, S2044-S2046 may be executed second, S2044-S2046 may be executed first, and S2041-S2043 may be executed second.
On the basis of the specific implementation of S201 to S204, when the target internet protocol includes the first internet protocol, refer to fig. 3, which is a diagram of an application scenario structure of the direct link establishment method according to the embodiment of the present application, where the application scenario structure includes a first terminal, a first server, a second server, and a second terminal, and steps executed by the first terminal, the first server, the second server, and the second terminal refer to the specific implementation of S201 to S204 when the target internet protocol includes the first internet protocol.
As an example, the first internet protocol may be IPv4, and the first internet protocol penetration policy is an IPv4 penetration policy, the socket corresponding to the first internet protocol is a socket corresponding to IPv4, the first internet protocol local address is an IPv4 local address, and the first internet protocol external network address is an IPv4 external network address.
In addition, in the embodiment of the present application, the target internet protocol includes a second internet protocol, and the target penetration policy includes a second internet protocol penetration policy; on the basis that the second internet protocol penetration policy corresponds to the second internet protocol; when S204 is specifically implemented, the first terminal creates a socket corresponding to the second internet protocol according to the second internet protocol penetration policy, and binds to the second internet protocol local address of the first terminal; and the second terminal creates a socket corresponding to the second Internet protocol according to the second Internet protocol penetration strategy and binds to a second Internet protocol local address of the second terminal.
As an example, the second internet protocol may be IPv6, and the second internet protocol penetration policy is an IPv6 penetration policy, the socket corresponding to the second internet protocol is a socket corresponding to IPv6, and the second internet protocol local address is an IPv6 local address.
S205: the first terminal sends a first address to a first server; the second terminal sends a second address to the first server.
In the embodiment of the present application, after the first terminal determines the first address and the second terminal determines the second address in S204, the first terminal needs to send the first address to the first server, and the second terminal needs to send the second address to the first server, so that the subsequent first server can send the second address to the first terminal, and send the first address to the second terminal, and the first terminal establishes a direct link between the two terminals based on the second address and the second terminal based on the bidirectional penetration of the first address.
S206: the first server sends the second address to the first terminal and the first address to the second terminal.
In the embodiment of the present application, the first terminal sends the first address to the first server corresponding to S205, and the second terminal sends the second address to the first server; the first server receives a first address sent by the first terminal and a second address sent by the second terminal. On the basis, the first server transmits the second address to the first terminal, and transmits the first address to the second terminal.
S207: the first terminal is based on the second address and the second terminal is based on the first address to penetrate in two directions until a direct link is established between the first terminal and the second terminal.
In the embodiment of the present application, the first server sends the second address to the first terminal and sends the first address to the second terminal corresponding to S206; the first terminal receives the second address sent by the first server, and the second terminal receives the first address sent by the first server. On the basis, the first terminal can penetrate through the second address to the second terminal, the second terminal can penetrate through the first address to the first terminal, and the direct connection link is established between the first terminal and the second terminal. Of course, in the implementation process of S207, there may be a phenomenon that the direct link establishment fails due to timeout.
Referring to fig. 4, a schematic diagram of bidirectional penetration of a first terminal and a second terminal according to an embodiment of the present application is shown. The first terminal accesses the public network through the first router, the second terminal accesses the public network through the second router, different mapping rules and filtering rules exist in network address conversion in the first router and the second router, and bidirectional penetration is needed through the S201-S207 until a direct link is established between the first terminal and the second terminal, so that direct transmission between the first terminal and the second terminal is realized, for example, file data, video data, audio and video call data, live broadcast data, virtual reality data and other data with large data volume are transmitted, and the security and confidentiality of the transmitted data are improved.
In the embodiment of the present application, in the case that the target internet protocol is the first internet protocol and the second internet protocol, the target penetration policy is the first internet protocol penetration policy and the second internet protocol penetration policy, the first address is the first internet protocol external network address and the second internet protocol local address of the first terminal, and the second address is the first internet protocol external network address and the second internet protocol local address of the second terminal. In the implementation of S207, when the first terminal penetrates to the second terminal based on the first internet protocol external network address of the second terminal on the basis that the first terminal and the second terminal both have the socket corresponding to the first internet protocol and the socket corresponding to the second internet protocol, the socket corresponding to the first internet protocol needs to be utilized, and when the first terminal penetrates to the second terminal based on the second internet protocol local address of the second terminal, the socket corresponding to the second internet protocol needs to be utilized; similarly, when the second terminal penetrates to the first terminal based on the first internet protocol external network address of the first terminal, a socket corresponding to the first internet protocol needs to be utilized, and when the second terminal penetrates to the first terminal based on the second internet protocol local address of the first terminal, a socket corresponding to the second internet protocol needs to be utilized. Thus, the present application provides one possible implementation, S207 may include, for example, the following S2071-S2074:
S2071: the first terminal penetrates through a socket corresponding to the first Internet protocol to the second terminal based on the first Internet protocol extranet address of the second terminal.
S2072: the first terminal penetrates through a socket corresponding to the second internet protocol to the second terminal based on a second internet protocol local address of the second terminal.
S2073: the second terminal penetrates through the socket corresponding to the first internet protocol to the first terminal based on the first internet protocol extranet address of the first terminal.
S2074: the second terminal penetrates through the socket corresponding to the second internet protocol to the first terminal based on the second internet protocol local address of the first terminal until a direct link is established between the first terminal and the second terminal.
Referring to fig. 5, a schematic diagram of penetration of a first terminal to a second terminal according to an embodiment of the present application is shown. On the basis of fig. 4, when the destination address of the data packet a to be sent at the first terminal side is the first internet protocol external network address of the second terminal, the first terminal sends the data packet a to be sent through a socket corresponding to the first internet protocol, so that the first terminal penetrates through the second terminal; when the destination address of the data packet b to be sent at the first terminal side is the second internet protocol local address of the second terminal, the first terminal sends the data packet b to be sent through the socket corresponding to the second internet protocol, so that the first terminal penetrates through the second terminal.
In the embodiment of the present application, when the target internet protocol is the first internet protocol, the target tunneling policy is the first internet protocol tunneling policy, the first address is the first internet protocol extranet address of the first terminal, and the second address is the first internet protocol extranet address of the second terminal. In the specific implementation of S207, since both the first terminal and the second terminal have only the socket corresponding to the first internet protocol, the first terminal penetrates to the second terminal through the socket corresponding to the first internet protocol based on the first internet protocol extranet address of the second terminal; the second terminal penetrates through the socket corresponding to the first internet protocol to the first terminal based on the first internet protocol extranet address of the first terminal until a direct link is established between the first terminal and the second terminal.
Similarly, if the target ip is the second ip, the target penetration policy is the second ip penetration policy, the first address is the second ip local address of the first terminal, and the second address is the second ip local address of the second terminal. In the specific implementation of S207, since both the first terminal and the second terminal have only the socket corresponding to the second internet protocol, the first terminal penetrates to the second terminal through the socket corresponding to the second internet protocol based on the second internet protocol local address of the second terminal; the second terminal penetrates through the socket corresponding to the second internet protocol to the first terminal based on the second internet protocol local address of the first terminal until a direct link is established between the first terminal and the second terminal.
As an example, the first internet protocol may be IPv4, the second internet protocol may be IPv6, for example, and the socket corresponding to the first internet protocol is a socket corresponding to IPv4, the first internet protocol local address is an IPv4 local address, the first internet protocol external network address is an IPv4 external network address, the socket corresponding to the second internet protocol is a socket corresponding to IPv6, and the second internet protocol local address is an IPv6 local address.
In addition, in the embodiment of the present application, based on the specific implementation of S207 in the case where the target internet protocol is the first internet protocol and the second internet protocol, the established direct link between the first terminal and the second terminal may include a first direct link corresponding to the first internet protocol and a second direct link corresponding to the second internet protocol. Because the routing paths of the first direct link and the second direct link have certain difference, the congestion degree is different and dynamically changed, wherein when one direct link is congested, the other direct link can be unblocked; in order to effectively reduce transmission time consumption and improve the effect and quality of integral direct-connection transmission, when in direct-connection transmission between a first terminal and a second terminal, a two-transmission strategy of a first direct-connection link and a second direct-connection link can be adopted in the beginning stage, namely, the second data packet is sent by the first direct-connection link and the second data packet is sent by the second direct-connection link. Thus, the present application provides a possible implementation manner, after S207, the direct link includes a first direct link corresponding to a first internet protocol and a second direct link corresponding to a second internet protocol, and the method may further include, for example, the following S1-S2:
S1: and the first terminal sends the second data packet to the second terminal through the first direct link within a preset time period.
S2: and the first terminal sends a second data packet to the second terminal through the second direct link within a preset time period.
And corresponding to the S1-S2, after the second terminal receives the second data packet, selecting and processing the first received second data packet, and discarding the second data packet received after the second terminal receives the second data packet.
Similarly, the first terminal may also send a fourth data packet to the first terminal through the first direct link in a preset time period; and the second terminal sends a fourth data packet to the first terminal through the second direct link within a preset time period. After the first terminal receives the fourth data packet, selecting and processing the first received fourth data packet, and discarding the second received fourth data packet.
In addition, in the embodiment of the present application, after the second terminal receives the second data packet in S1-S2, the second terminal selects to process the first received second data packet, discards the second data packet received after that, which indicates that each direct link has a certain packet receiving utilization rate in a preset time period, and the packet receiving utilization rate can be used to measure whether the direct link is continuously available. Then it can also be determined whether the first packet receiving utilization rate of the first direct link is less than a preset utilization rate, the preset utilization rate is greater than 0, and the preset utilization rate is less than or equal to 0.5; if so, the first terminal sends the second data packet to the second terminal through the first direct link and is mostly discarded by the second terminal, so that the first terminal stops sending the second data packet to the second terminal through the first direct link in order to save the resource consumption of direct transmission. Similarly, it may also be determined whether the second packet receiving utilization rate of the second direct link is less than the preset utilization rate, if so, it indicates that the first terminal sends the second data packet to the second terminal through the second direct link, where most of the second data packet is discarded by the second terminal, and in order to save the resource consumption of direct transmission, the first terminal stops sending the second data packet to the second terminal through the second direct link. Thus, the present application provides a possible implementation, after S1-S2, the method may for example further comprise the following S3-S4:
S3: if the first packet receiving utilization rate of the first direct link is smaller than the preset utilization rate within the preset time period, the first terminal stops sending the second data packet to the second terminal through the first direct link; the preset utilization rate is greater than 0, and the preset utilization rate is less than or equal to 0.5.
S4: if the second packet receiving utilization rate of the second direct link is smaller than the preset utilization rate within the preset time period, the first terminal stops sending the second data packet to the second terminal through the second direct link.
The calculation formulas of the first packet receiving utilization rate and the second packet receiving utilization rate are as follows:
the total number of the data packets processed after transmission refers to the sum of the number of the data packets processed after transmission of the first direct link and the number of the data packets processed after transmission of the second direct link, and then the sum of the first packet receiving utilization rate and the second packet receiving utilization rate is 1.
The preset utilization rate is alpha, alpha is more than 0 and less than or equal to 0.5, and alpha can be adjusted according to actual requirements. When α=0.5, there is no possibility that the first packet receiving utilization rate and the second packet receiving utilization rate are both greater than 0.5, and then the first terminal necessarily stops sending the second data packet to the second terminal through one of the first direct link and the second direct link; unless the first packet reception utilization and the second packet reception utilization are equal to 0.5.
Of course, if the adjustment α is 0, there is no possibility that the first packet receiving availability or the second packet receiving availability is less than 0, the first terminal always keeps sending the second data packet to the second terminal through the first direct link, and sends the second data packet to the second terminal through the second direct link.
As an example, the first internet protocol may be IPv4, for example, and the second internet protocol may be IPv6, for example; the first direct link corresponding to the first internet protocol is a first direct link corresponding to IPv4, which may be simply referred to as an IPv4 direct link, and the second direct link corresponding to the second internet protocol is a second direct link corresponding to IPv6, which may be simply referred to as an IPv6 direct link.
In the direct link establishment method provided in the above embodiment, the first terminal sends a first internet protocol stack type determined by an internet protocol supported by the first terminal to the first server, and the second terminal sends a second internet protocol stack type determined by an internet protocol supported by the second terminal to the first server; and the first server determines a target penetration strategy corresponding to a target Internet protocol supported by both the first terminal and the second terminal according to the first Internet protocol stack type and the second Internet protocol stack type, and sends the target penetration strategy to the first terminal and the second terminal. The first terminal determines a first address corresponding to the target penetration strategy and sends the first address to the first server, and the second terminal determines a first address corresponding to the target penetration strategy and sends the first address to the first server; the first server sends a second address to the first terminal and sends a first address to the second terminal; the first terminal is based on the second address and the second terminal is based on the first address to penetrate in two directions until a direct link is established between the first terminal and the second terminal.
The server collects the internet protocol supported by both terminals, adaptively selects the penetration strategy corresponding to the internet protocol supported by both terminals, and exchanges the address of the penetration strategy corresponding to both terminals, so as to establish a direct link between both terminals through bidirectional penetration. Based on this, even in the case that the internet protocol supported by both terminals is complicated, the method can effectively establish the direct link between both terminals, thereby improving the success rate and efficiency of establishing the direct link.
Based on the control method for establishing the direct link and the method for establishing the direct link, the embodiment of the application also provides an application method for establishing the direct link when the first internet protocol stack type and the second internet protocol stack type are both IPv4/IPv6 dual stacks; referring to fig. 6, the diagram is a signaling interaction diagram of an application method for establishing a direct link according to an embodiment of the present application. As shown in fig. 6, the application method for establishing the direct link includes the following steps:
s601: the first terminal sends a first internet protocol stack type 'IPv 4/IPv6 dual stack' and first operator information to a first server; the second terminal sends a second internet protocol stack type 'IPv 4/IPv6 dual stack' and second operator information to the first server.
S602: the first server determines an IPv4 penetration policy and an IPv6 penetration policy according to a first internet protocol stack type IPv4/IPv6 dual stack and a second internet protocol stack type IPv4/IPv6 dual stack.
S603: the first server determines a network address of the second server according to the first operator information and the second operator information; the second server supports IPv4.
S604: the first server transmits an IPv4 penetration policy, an IPv6 penetration policy and a network address to the first terminal and the second terminal.
S605: the method comprises the steps that a first terminal creates a socket corresponding to IPv4 according to an IPv4 penetration policy, binds to an IPv4 local address of the first terminal, creates a socket corresponding to IPv6 according to an IPv6 penetration policy, and binds to an IPv6 local address of the first terminal; the second terminal creates a socket corresponding to IPv4 according to the IPv4 penetration policy and binds to an IPv4 local address of the second terminal, and creates a socket corresponding to IPv6 according to the IPv6 penetration policy and binds to an IPv6 local address of the second terminal.
S606: the first terminal sends a data packet 1 to the second server through a socket corresponding to IPv4 according to the network address, and the source address of the data packet 1 is the IPv4 local address of the first terminal; and the second terminal sends a data packet 2 to the second server through the socket corresponding to the IPv4 according to the network address, and the source address of the data packet 2 is the IPv4 local address of the second terminal.
S607: the method comprises the steps that a first terminal receives an IPv4 external network address of the first terminal, which is sent by a second server, wherein the IPv4 external network address of the first terminal is obtained by converting an IPv4 local address of the first terminal by the second server; the second terminal receives an IPv4 external network address of the second terminal sent by the second server, wherein the IPv4 external network address of the second terminal is obtained by converting a network address of an IPv4 local address of the second terminal by the second server.
S608: the method comprises the steps that a first terminal sends an IPv4 external network address and an IPv6 local address of the first terminal to a first server; the second terminal sends the IPv4 external network address and the IPv6 local address of the second terminal to the first server.
S609: the first server sends the IPv4 external network address and the IPv6 local address of the second terminal to the first terminal, and sends the IPv4 external network address and the IPv6 local address of the first terminal to the second terminal.
S610: the first terminal penetrates to the second terminal through the socket corresponding to the IPv4 based on the IPv4 external network address of the second terminal, and penetrates to the second terminal through the socket corresponding to the IPv6 based on the IPv6 local address of the second terminal; the second terminal penetrates through the socket corresponding to the IPv4 based on the IPv4 external network address of the first terminal to the first terminal, and penetrates through the socket corresponding to the IPv6 based on the IPv6 local address of the first terminal to the first terminal until a direct link is established between the first terminal and the second terminal.
S611: the first terminal sends the data packet 3 to the second terminal through the first direct link corresponding to the IPv4 in a preset time period, and sends the data packet 3 to the second terminal through the second direct link corresponding to the IPv 6.
S612: if the first packet receiving utilization rate alpha of the first direct link within the preset time period 1 The data packet 3 is stopped being sent to the second terminal through the first direct link when the utilization rate is smaller than the preset utilization rate alpha; if the second packet receiving utilization rate alpha of the second direct link within the preset time period 2 The data packet 3,0 </is stopped being sent to the second terminal through the second direct link when the utilization rate is smaller than the preset utilization rate alphaα≤0.5。
Aiming at the control method for establishing the direct link provided by the embodiment, the embodiment of the application also provides a control device for establishing the direct link.
Referring to fig. 7, the schematic diagram of a control device for establishing a direct link according to an embodiment of the present application is shown. As shown in fig. 7, the control device 700 for direct link establishment is applied to a first server, and includes: a first receiving unit 701, a first determining unit 702, a first transmitting unit 703, a second receiving unit 704, and a second transmitting unit 705;
a first receiving unit 701, configured to receive a first internet protocol stack type sent by a first terminal and a second internet protocol stack type sent by a second terminal; the first internet protocol stack type is determined by the internet protocol supported by the first terminal and the second internet protocol stack type is determined by the internet protocol supported by the second terminal;
A first determining unit 702, configured to determine a target penetration policy corresponding to a target internet protocol according to the first internet protocol stack type and the second internet protocol stack type; the target internet protocol is an internet protocol supported by both the first terminal and the second terminal;
a first transmitting unit 703, configured to transmit a target penetration policy to the first terminal and the second terminal;
a second receiving unit 704, configured to receive a first address of the first terminal corresponding to the target penetration policy and a second address of the second terminal corresponding to the target penetration policy;
a second transmitting unit 705, configured to transmit a second address to the first terminal and transmit a first address to the second terminal; so that the first terminal penetrates in both directions based on the second address and the second terminal based on the first address until a direct link is established between the first terminal and the second terminal.
As one possible implementation, the target internet protocol is a first internet protocol and a second internet protocol, the first terminal and the second terminal penetrate through an external network address under the first internet protocol, the first terminal and the second terminal penetrate through a local address under the second internet protocol, the target penetration policy is a first internet protocol penetration policy and a second internet protocol penetration policy, the first address is a first internet protocol external network address and a second internet protocol local address of the first terminal, and the second address is a first internet protocol external network address and a second internet protocol local address of the second terminal; or alternatively, the first and second heat exchangers may be,
The target internet protocol is a first internet protocol, the target penetration policy is a first internet protocol penetration policy, the first address is a first internet protocol extranet address of the first terminal, and the second address is a first internet protocol extranet address of the second terminal; or alternatively, the first and second heat exchangers may be,
the target internet protocol is a second internet protocol, the target tunneling policy is a second internet protocol tunneling policy, the first address is a second internet protocol local address of the first terminal, and the second address is a second internet protocol local address of the second terminal.
As a possible implementation manner, when the target internet protocol includes the first internet protocol, the first receiving unit 701 is specifically configured to:
receiving a first Internet protocol stack type, first server information sent by a first terminal, a second Internet protocol stack type and second server information sent by a second terminal; the first server information is information of a server to which the first terminal belongs, and the second server information is information of a server to which the second terminal belongs;
the first transmitting unit 703 includes: determining a subunit and a first sending subunit;
the determining subunit is used for determining the network address of the second server according to the first server information and the second server information; the second server supporting the first internet protocol;
A first transmitting subunit, configured to transmit a first ip penetration policy and a network address to the first terminal and the second terminal; so that the first terminal obtains the first internet protocol extranet address of the first terminal from the second server according to the first internet protocol penetration policy and the network address, and the second terminal obtains the first internet protocol extranet address of the second terminal from the second server according to the first internet protocol penetration policy and the network address.
In the control device for establishing a direct link provided in the foregoing embodiment, a first terminal sends a first internet protocol stack type determined by an internet protocol supported by the first terminal to a first server, and a second terminal sends a second internet protocol stack type determined by an internet protocol supported by the second terminal to the first server; and the first server determines a target penetration strategy corresponding to a target Internet protocol supported by both the first terminal and the second terminal according to the first Internet protocol stack type and the second Internet protocol stack type, and sends the target penetration strategy to the first terminal and the second terminal. The first terminal determines a first address corresponding to the target penetration strategy and sends the first address to the first server, and the second terminal determines a first address corresponding to the target penetration strategy and sends the first address to the first server; the first server sends a second address to the first terminal and sends a first address to the second terminal; the first terminal is based on the second address and the second terminal is based on the first address to penetrate in two directions until a direct link is established between the first terminal and the second terminal.
The server collects the internet protocol supported by both terminals, adaptively selects the penetration strategy corresponding to the internet protocol supported by both terminals, and exchanges the address of the penetration strategy corresponding to both terminals, so as to establish a direct link between both terminals through bidirectional penetration. Based on this, even in the case that the internet protocol supported by both terminals is complicated, the method can effectively establish the direct link between both terminals, thereby improving the success rate and efficiency of establishing the direct link.
Aiming at the direct link establishment method provided by the embodiment, the embodiment of the application also provides a direct link establishment device.
Referring to fig. 8, a schematic diagram of a direct link establishment apparatus according to an embodiment of the present application is shown. As shown in fig. 8, the direct link establishment apparatus 800 is applied to a first terminal, and includes: a third transmitting unit 801, a third receiving unit 802, a second determining unit 803, a fourth transmitting unit 804, a fourth receiving unit 805, and a setting-up unit 806;
a third sending unit 801, configured to send a first internet protocol stack type to a first server; the first internet protocol stack type is determined by an internet protocol supported by the first terminal;
A third receiving unit 802, configured to receive a target penetration policy corresponding to a target internet protocol sent by the first server; the target penetration strategy is determined by the first server according to a first internet protocol stack type and a second internet protocol stack type sent by the second terminal, the second internet protocol stack type is determined by an internet protocol supported by the second terminal, and the target internet protocol is an internet protocol supported by both the first terminal and the second terminal;
a second determining unit 803, configured to determine a first address corresponding to the target penetration policy;
a fourth transmitting unit 804, configured to transmit the first address to the first server; so that the first server sends the first address to the second terminal, and the second terminal penetrates to the first terminal based on the first address;
a fourth receiving unit 805, configured to receive a second address of the target penetration policy corresponding to the second terminal sent by the first server;
an establishing unit 806 is configured to penetrate towards the second terminal based on the second address until a direct link is established between the first terminal and the second terminal.
As one possible implementation, the target internet protocol is a first internet protocol and a second internet protocol, the first terminal and the second terminal penetrate through an external network address under the first internet protocol, the first terminal and the second terminal penetrate through a local address under the second internet protocol, the target penetration policy is a first internet protocol penetration policy and a second internet protocol penetration policy, the first address is a first internet protocol external network address and a second internet protocol local address of the first terminal, and the second address is a first internet protocol external network address and a second internet protocol local address of the second terminal; or alternatively, the first and second heat exchangers may be,
The target internet protocol is a first internet protocol, the target penetration policy is a first internet protocol penetration policy, the first address is a first internet protocol extranet address of the first terminal, and the second address is a first internet protocol extranet address of the second terminal; or alternatively, the first and second heat exchangers may be,
the target internet protocol is a second internet protocol, the target tunneling policy is a second internet protocol tunneling policy, the first address is a second internet protocol local address of the first terminal, and the second address is a second internet protocol local address of the second terminal.
As a possible implementation manner, when the target internet protocol includes the first internet protocol, the third sending unit 801 is specifically configured to:
transmitting a first Internet protocol stack type and first server information to a first server; the first server information is information of a server to which the first terminal belongs;
the third receiving unit 802 is specifically configured to:
receiving a first Internet protocol penetration strategy and a network address of a second server sent by a first server; the second server supports a first Internet protocol, the network address is determined by the first server according to the first server information and second server information sent by the second terminal, and the second server information is information of a server to which the second terminal belongs;
The second determining unit 803 is specifically configured to:
and acquiring the first internet protocol external network address of the first terminal from the second server according to the first internet protocol penetration strategy and the network address.
As a possible implementation manner, the second determining unit 803 includes: creating a subunit, a second sending subunit and a receiving subunit;
the creating subunit is used for creating a socket corresponding to the first internet protocol according to the first internet protocol penetration policy and binding the socket to the first internet protocol local address of the first terminal;
the second sending subunit is used for sending a first data packet to the second server through a socket corresponding to the first internet protocol according to the network address, and the source address of the first data packet is the first internet protocol local address of the first terminal;
and the receiving subunit is used for receiving the first internet protocol external network address of the first terminal sent by the second server, wherein the first internet protocol external network address of the first terminal is obtained by converting the network address of the first internet protocol local address of the first terminal by the second server.
As a possible implementation manner, when the target internet protocol is the first internet protocol and the second internet protocol, the establishing unit 806 includes: a third transmitting subunit and a setup subunit;
The third sending subunit is used for penetrating the second terminal to the second terminal based on the first internet protocol external network address of the second terminal through the socket corresponding to the first internet protocol;
and the establishing subunit is used for penetrating the second terminal to the second terminal based on the second Internet protocol local address of the second terminal through the socket corresponding to the second Internet protocol until the direct link is established.
As a possible implementation manner, the direct link includes a first direct link corresponding to a first internet protocol and a second direct link corresponding to a second internet protocol, and the apparatus further includes: a fifth transmitting unit and a sixth transmitting unit;
a fifth transmitting unit, configured to transmit a second data packet to the second terminal through the first direct link in a preset period of time;
and the sixth sending unit is used for sending the second data packet to the second terminal through the second direct link in a preset time period.
As a possible implementation manner, the apparatus further includes: a first stopping unit and a second stopping unit;
the first stopping unit is used for stopping sending the second data packet to the second terminal through the first direct link if the first packet receiving utilization rate of the first direct link is smaller than the preset utilization rate within the preset time period; the preset utilization rate is greater than 0, and the preset utilization rate is less than or equal to 0.5;
And the second stopping unit is used for stopping sending the second data packet to the second terminal through the second direct link if the second packet receiving utilization rate of the second direct link in the preset time period is smaller than the preset utilization rate.
In the direct link establishment device provided in the foregoing embodiment, the first terminal sends, to the first server, a first internet protocol stack type determined by an internet protocol supported by the first terminal, and the second terminal sends, to the first server, a second internet protocol stack type determined by an internet protocol supported by the second terminal; and the first server determines a target penetration strategy corresponding to a target Internet protocol supported by both the first terminal and the second terminal according to the first Internet protocol stack type and the second Internet protocol stack type, and sends the target penetration strategy to the first terminal and the second terminal. The first terminal determines a first address corresponding to the target penetration strategy and sends the first address to the first server, and the second terminal determines a first address corresponding to the target penetration strategy and sends the first address to the first server; the first server sends a second address to the first terminal and sends a first address to the second terminal; the first terminal is based on the second address and the second terminal is based on the first address to penetrate in two directions until a direct link is established between the first terminal and the second terminal.
The server collects the internet protocol supported by both terminals, adaptively selects the penetration strategy corresponding to the internet protocol supported by both terminals, and exchanges the address of the penetration strategy corresponding to both terminals, so as to establish a direct link between both terminals through bidirectional penetration. Based on this, even in the case that the internet protocol supported by both terminals is complicated, the method can effectively establish the direct link between both terminals, thereby improving the success rate and efficiency of establishing the direct link.
The embodiment of the application also provides a computer device for controlling the establishment of the direct link or a computer device for establishing the direct link, and the computer device provided by the embodiment of the application is introduced from the aspect of hardware materialization.
Aiming at the control method for establishing the direct link, the embodiment of the application also provides a computer device for controlling the establishment of the direct link, so that the control method for establishing the direct link is realized and applied in practice.
Referring to fig. 9, fig. 9 is a schematic diagram of a server structure according to an embodiment of the present application, where the server 900 may have a relatively large difference due to configuration or performance, and may include one or more central processing units (Central Processing Units, CPU) 922 (e.g., one or more processors) and a memory 932, and one or more storage media 930 (e.g., one or more mass storage devices) storing application programs 942 or data 944. Wherein the memory 932 and the storage medium 930 may be transitory or persistent. The program stored in the storage medium 930 may include one or more modules (not shown), each of which may include a series of instruction operations on a server. Still further, the central processor 922 may be arranged to communicate with a storage medium 930 to execute a series of instruction operations in the storage medium 930 on the server 900.
The Server 900 may also include one or more power supplies 926, one or more wired or wireless network interfaces 950, one or more input/output interfaces 958, and/or one or more operating systems 941, such as Windows Server TM ,Mac OS X TM ,Unix TM ,Linux TM ,FreeBSD TM Etc.
The steps performed by the server in the above embodiments may be based on the server structure shown in fig. 9.
For example, CPU 922 is configured to perform the steps of:
receiving a first internet protocol stack type sent by a first terminal and a second internet protocol stack type sent by a second terminal; the first internet protocol stack type is determined by the internet protocol supported by the first terminal and the second internet protocol stack type is determined by the internet protocol supported by the second terminal;
determining a target penetration strategy corresponding to a target Internet protocol according to the first Internet protocol stack type and the second Internet protocol stack type; the target internet protocol is an internet protocol supported by both the first terminal and the second terminal;
transmitting a target penetration policy to the first terminal and the second terminal;
receiving a first address of a target penetration strategy corresponding to a first terminal and a second address of the target penetration strategy corresponding to a second terminal;
sending the second address to the first terminal and sending the first address to the second terminal; so that the first terminal penetrates in both directions based on the second address and the second terminal based on the first address until a direct link is established between the first terminal and the second terminal.
Aiming at the direct link establishment method, the embodiment of the application also provides a computer device for establishing the direct link, so that the direct link establishment method is realized and applied in practice.
Referring to fig. 10, fig. 10 is a schematic structural diagram of a terminal device according to an embodiment of the present application. For convenience of explanation, only those portions of the embodiments of the present application that are relevant to the embodiments of the present application are shown, and specific technical details are not disclosed, please refer to the method portions of the embodiments of the present application. The terminal equipment can be any terminal equipment including a mobile phone, a tablet personal computer, a PDA and the like, and takes the terminal equipment as the mobile phone as an example:
fig. 10 is a block diagram showing a part of the structure of a mobile phone related to a terminal device provided by an embodiment of the present application. Referring to fig. 10, the mobile phone includes: radio Frequency (RF) circuitry 1010, memory 1020, input unit 1030, display unit 1040, sensor 1050, audio circuitry 1060, wireless fidelity (WiFi) module 1070, processor 1080, and power source 1090. It will be appreciated by those skilled in the art that the handset construction shown in fig. 10 is not limiting of the handset and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
The following describes the components of the mobile phone in detail with reference to fig. 10:
the RF circuit 1010 may be used for receiving and transmitting signals during a message or a call, and particularly, after receiving downlink information of a base station, the signal is processed by the processor 1080; in addition, the data of the design uplink is sent to the base station. Generally, RF circuitry 1010 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (Low Noise Amplifier, LNA for short), a duplexer, and the like. In addition, the RF circuitry 1010 may also communicate with networks and other devices via wireless communications. The wireless communication may use any communication standard or protocol, including but not limited to global system for mobile communications (Global System of Mobile communication, GSM for short), general packet radio service (General Packet Radio Service, GPRS for short), code division multiple access (Code Division Multiple Access, CDMA for short), wideband code division multiple access (Wideband Code Division Multiple Access, WCDMA for short), long term evolution (Long TermEvolution, LTE for short), email, short message service (Short Messaging Service, SMS for short), and the like.
The memory 1020 may be used to store software programs and modules, and the processor 1080 may implement various functional applications and data processing of the cell phone by executing the software programs and modules stored in the memory 1020. The memory 1020 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 (such as audio data, phonebook, etc.) created according to the use of the handset, etc. In addition, memory 1020 may include high-speed random access memory and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state memory device.
The input unit 1030 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the handset. In particular, the input unit 1030 may include a touch panel 1031 and other input devices 1032. The touch panel 1031, also referred to as a touch screen, may collect touch operations thereon or thereabout by a user (e.g., operations of the user on the touch panel 1031 or thereabout using any suitable object or accessory such as a finger, stylus, etc.), and drive the corresponding connection device according to a predetermined program. Alternatively, the touch panel 1031 may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch azimuth of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device and converts it into touch point coordinates, which are then sent to the processor 1080 and can receive commands from the processor 1080 and execute them. Further, the touch panel 1031 may be implemented in various types such as resistive, capacitive, infrared, and surface acoustic wave. The input unit 1030 may include other input devices 1032 in addition to the touch panel 1031. In particular, other input devices 1032 may include, but are not limited to, one or more of a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a track ball, a mouse, a joystick, etc.
The display unit 1040 may be used to display information input by a user or information provided to the user and various menus of the mobile phone. The display unit 1040 may include a display panel 1041, and alternatively, the display panel 1041 may be configured in the form of a liquid crystal display (Liquid Crystal Display, LCD) or an Organic Light-Emitting Diode (OLED) or the like. Further, the touch panel 1031 may overlay the display panel 1041, and when the touch panel 1031 detects a touch operation thereon or thereabout, the touch panel is transferred to the processor 1080 to determine a type of touch event, and then the processor 1080 provides a corresponding visual output on the display panel 1041 according to the type of touch event. Although in fig. 10, the touch panel 1031 and the display panel 1041 are two independent components to implement the input and output functions of the mobile phone, in some embodiments, the touch panel 1031 and the display panel 1041 may be integrated to implement the input and output functions of the mobile phone.
The handset may also include at least one sensor 1050, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 1041 according to the brightness of ambient light, and the proximity sensor may turn off the display panel 1041 and/or the backlight when the mobile phone moves to the ear. As one of the motion sensors, the accelerometer sensor can detect the acceleration in all directions (generally three axes), and can detect the gravity and direction when stationary, and can be used for applications of recognizing the gesture of a mobile phone (such as horizontal and vertical screen switching, related games, magnetometer gesture calibration), vibration recognition related functions (such as pedometer and knocking), and the like; other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc. that may also be configured with the handset are not described in detail herein.
Audio circuitry 1060, a speaker 1061, and a microphone 1062 may provide an audio interface between a user and a cell phone. Audio circuit 1060 may transmit the received electrical signal after audio data conversion to speaker 1061 for conversion by speaker 1061 into an audio signal output; on the other hand, microphone 1062 converts the collected sound signals into electrical signals, which are received by audio circuit 1060 and converted into audio data, which are processed by audio data output processor 1080 for transmission to, for example, another cell phone via RF circuit 1010 or for output to memory 1020 for further processing.
WiFi belongs to a short-distance wireless transmission technology, and a mobile phone can help a user to send and receive emails, browse webpages, access streaming media and the like through a WiFi module 1070, so that wireless broadband Internet access is provided for the user. Although fig. 10 shows a WiFi module 1070, it is understood that it does not belong to the necessary constitution of the handset, and can be omitted entirely as required within the scope of not changing the essence of the invention.
Processor 1080 is the control center of the handset, connects the various parts of the entire handset using various interfaces and lines, and performs various functions and processes of the handset by running or executing software programs and/or modules stored in memory 1020, and invoking data stored in memory 1020. Optionally, processor 1080 may include one or more processing units; preferably, processor 1080 may integrate an application processor primarily handling operating systems, user interfaces, applications, etc., with a modem processor primarily handling wireless communications. It will be appreciated that the modem processor described above may not be integrated into processor 1080.
The handset further includes a power source 1090 (e.g., a battery) for powering the various components, which may preferably be logically connected to the processor 1080 by a power management system, such as to provide for managing charging, discharging, and power consumption by the power management system.
Although not shown, the mobile phone may further include a camera, a bluetooth module, etc., which will not be described herein.
In an embodiment of the present application, the memory 1020 included in the mobile phone may store program codes and transmit the program codes to the processor.
The processor 1080 included in the handset may perform the following steps according to instructions in the program code:
transmitting a first internet protocol stack type to a first server; the first internet protocol stack type is determined by an internet protocol supported by the first terminal;
receiving a target penetration strategy corresponding to a target Internet protocol sent by a first server; the target penetration strategy is determined by the first server according to a first internet protocol stack type and a second internet protocol stack type sent by the second terminal, the second internet protocol stack type is determined by an internet protocol supported by the second terminal, and the target internet protocol is an internet protocol supported by both the first terminal and the second terminal;
Determining a first address corresponding to a target penetration strategy;
transmitting the first address to a first server; so that the first server sends the first address to the second terminal, and the second terminal penetrates to the first terminal based on the first address;
receiving a second address of a target penetration strategy corresponding to a second terminal sent by a first server;
and penetrating the second terminal based on the second address until a direct link is established between the first terminal and the second terminal.
The embodiment of the application also provides a computer readable storage medium for storing a computer program for executing the control method for establishing a direct link or the method for establishing a direct link provided in the above embodiment.
Embodiments of the present application also provide a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The computer instructions are read from a computer-readable storage medium by a processor of a computer device, and executed by the processor, cause the computer device for control of direct link establishment to perform the control method of direct link establishment provided in the various alternative implementations of the above aspect, or cause the computer device for direct link establishment to perform the control method of direct link provided in the various alternative implementations of the above aspect.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the above method embodiments may be implemented by hardware related to program instructions, where the above program may be stored in a computer readable storage medium, and when the program is executed, the program performs steps including the above method embodiments; and the aforementioned storage medium may be at least one of the following media: read-Only Memory (ROM), random access Memory (RandomAccess Memory, RAM), magnetic or optical disk, and the like, which can store program codes.
It should be noted that, in the present specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment is mainly described in a different point from other embodiments. In particular, for the apparatus and system embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, with reference to the description of the method embodiments in part. The apparatus and system embodiments described above are merely illustrative, in which elements illustrated as separate elements may or may not be physically separate, and elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
The foregoing is only one specific embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions easily contemplated by those skilled in the art within the technical scope of the present application should be included in the scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims (15)

1. A control method for direct link establishment, applied to a first server, the method comprising:
receiving a first internet protocol stack type sent by a first terminal and a second internet protocol stack type sent by a second terminal; the first internet protocol stack type is determined by an internet protocol supported by the first terminal, and the second internet protocol stack type is determined by an internet protocol supported by the second terminal;
determining a target penetration strategy corresponding to a target internet protocol according to the first internet protocol stack type and the second internet protocol stack type; the target internet protocol is an internet protocol supported by both the first terminal and the second terminal;
transmitting the target penetration policy to the first terminal and the second terminal;
Receiving a first address of the first terminal corresponding to the target penetration policy and a second address of the second terminal corresponding to the target penetration policy;
the second address is sent to the first terminal, and the first address is sent to the second terminal; so that the first terminal penetrates in two directions based on the second address and the second terminal penetrates in two directions based on the first address until a direct connection link is established between the first terminal and the second terminal.
2. The method of claim 1, wherein the target internet protocol is a first internet protocol and a second internet protocol, the first terminal and the second terminal are penetrated by an external internet address under the first internet protocol, the first terminal and the second terminal are penetrated by a local address under the second internet protocol, the target penetration policy is a first internet protocol penetration policy and a second internet protocol penetration policy, the first address is a first internet protocol external internet address and a second internet protocol local address of the first terminal, and the second address is a first internet protocol external internet address and a second internet protocol local address of the second terminal; or alternatively, the first and second heat exchangers may be,
The target internet protocol is the first internet protocol, the target penetration policy is the first internet protocol penetration policy, the first address is a first internet protocol extranet address of the first terminal, and the second address is a first internet protocol extranet address of the second terminal; or alternatively, the first and second heat exchangers may be,
the target internet protocol is the second internet protocol, the target penetration policy is the second internet protocol penetration policy, the first address is a second internet protocol local address of the first terminal, and the second address is a second internet protocol local address of the second terminal.
3. The method of claim 2, wherein when the target internet protocol includes the first internet protocol, the receiving the first internet protocol stack type sent by the first terminal and the second internet protocol stack type sent by the second terminal comprises:
receiving the first internet protocol stack type, the first server information sent by the first terminal, the second internet protocol stack type and the second server information sent by the second terminal; the first server information is information of a server to which the first terminal belongs, and the second server information is information of a server to which the second terminal belongs;
The sending the target penetration policy to the first terminal and the second terminal includes:
determining a network address of a second server according to the first server information and the second server information; the second server supporting the first internet protocol;
transmitting the first internet protocol penetration policy and the network address to the first terminal and the second terminal; so that the first terminal obtains a first internet protocol external network address of the first terminal from the second server according to the first internet protocol penetration policy and the network address, and the second terminal obtains the first internet protocol external network address of the second terminal from the second server according to the first internet protocol penetration policy and the network address.
4. A method for establishing a direct link, applied to a first terminal, the method comprising:
transmitting a first internet protocol stack type to a first server; the first internet protocol stack type is determined by an internet protocol supported by the first terminal;
receiving a target penetration strategy of a corresponding target Internet protocol sent by the first server; the target penetration policy is determined by the first server according to the first internet protocol stack type and a second internet protocol stack type sent by a second terminal, the second internet protocol stack type is determined by an internet protocol supported by the second terminal, and the target internet protocol is an internet protocol supported by both the first terminal and the second terminal;
Determining a first address corresponding to the target penetration policy;
transmitting the first address to the first server; so that the first server sends the first address to the second terminal, and the second terminal penetrates through to the first terminal based on the first address;
receiving a second address, corresponding to the target penetration policy, of the second terminal, which is sent by the first server;
and penetrating the second terminal based on the second address until a direct link is established between the first terminal and the second terminal.
5. The method of claim 4, wherein the target internet protocol is a first internet protocol and a second internet protocol, the first terminal and the second terminal are penetrated by an external internet address under the first internet protocol, the first terminal and the second terminal are penetrated by a local address under the second internet protocol, the target penetration policy is a first internet protocol penetration policy and a second internet protocol penetration policy, the first address is a first internet protocol external internet address and a second internet protocol local address of the first terminal, and the second address is a first internet protocol external internet address and a second internet protocol local address of the second terminal; or alternatively, the first and second heat exchangers may be,
The target internet protocol is the first internet protocol, the target penetration policy is the first internet protocol penetration policy, the first address is a first internet protocol extranet address of the first terminal, and the second address is a first internet protocol extranet address of the second terminal; or alternatively, the first and second heat exchangers may be,
the target internet protocol is the second internet protocol, the target penetration policy is the second internet protocol penetration policy, the first address is a second internet protocol local address of the first terminal, and the second address is a second internet protocol local address of the second terminal.
6. The method of claim 5, wherein when the target internet protocol comprises the first internet protocol, the sending the first internet protocol stack type to the first server comprises:
transmitting the first internet protocol stack type and first server side information to the first server; the first server information is information of a server to which the first terminal belongs;
the receiving the target penetration policy of the corresponding target internet protocol sent by the first server includes:
receiving the first internet protocol penetration policy and a network address of a second server sent by the first server; the second server supports the first Internet protocol, the network address is determined by the first server according to the first server information and second server information sent by the second terminal, and the second server information is information of a server to which the second terminal belongs;
The determining a first address corresponding to the target penetration policy includes:
and acquiring a first internet protocol extranet address of the first terminal from the second server according to the first internet protocol penetration strategy and the network address.
7. The method of claim 6, wherein the obtaining the first internet protocol extranet address of the first terminal from the second server according to the first internet protocol penetration policy and the network address comprises:
creating a socket corresponding to the first internet protocol according to the first internet protocol penetration strategy, and binding the socket to a first internet protocol local address of the first terminal;
transmitting a first data packet to the second server through a socket corresponding to the first internet protocol according to the network address, wherein the source address of the first data packet is a first internet protocol local address of the first terminal;
and receiving a first internet protocol external network address of the first terminal, which is sent by the second server, wherein the first internet protocol external network address of the first terminal is obtained by converting a network address of a first internet protocol local address of the first terminal by the second server.
8. The method of claim 5, wherein when the target internet protocol is the first internet protocol and the second internet protocol, the penetrating the second terminal based on the second address until a direct link is established between the first terminal and the second terminal comprises:
penetrating through a socket corresponding to the first internet protocol to the second terminal based on a first internet protocol external network address of the second terminal;
and penetrating the second terminal to the second terminal based on a second Internet protocol local address of the second terminal through a socket corresponding to the second Internet protocol until the direct link is established.
9. The method of claim 8, wherein the direct link comprises a first direct link corresponding to the first internet protocol and a second direct link corresponding to the second internet protocol, the method further comprising:
transmitting a second data packet to the second terminal through the first direct link within a preset time period;
and sending the second data packet to the second terminal through the second direct link within the preset time period.
10. The method according to claim 9, wherein the method further comprises:
If the first packet receiving utilization rate of the first direct link is smaller than the preset utilization rate in the preset time period, stopping sending the second data packet to the second terminal through the first direct link; the preset utilization rate is greater than 0, and the preset utilization rate is less than or equal to 0.5;
and if the second packet receiving utilization rate of the second direct link in the preset time period is smaller than the preset utilization rate, stopping sending the second data packet to the second terminal through the second direct link.
11. A control device for direct link establishment, applied to a first server, the device comprising: a first receiving unit, a first determining unit, a first transmitting unit, a second receiving unit and a second transmitting unit;
the first receiving unit is configured to receive a first internet protocol stack type sent by a first terminal and a second internet protocol stack type sent by a second terminal; the first internet protocol stack type is determined by an internet protocol supported by the first terminal, and the second internet protocol stack type is determined by an internet protocol supported by the second terminal;
the first determining unit is configured to determine a target penetration policy corresponding to a target internet protocol according to the first internet protocol stack type and the second internet protocol stack type; the target internet protocol is an internet protocol supported by both the first terminal and the second terminal;
The first sending unit is configured to send the target penetration policy to the first terminal and the second terminal;
the second receiving unit is configured to receive a first address of the first terminal corresponding to the target penetration policy and a second address of the second terminal corresponding to the target penetration policy;
the second sending unit is configured to send the second address to the first terminal and send the first address to the second terminal; so that the first terminal penetrates in two directions based on the second address and the second terminal penetrates in two directions based on the first address until a direct connection link is established between the first terminal and the second terminal.
12. A direct link establishment apparatus, applied to a first terminal, comprising: a third transmitting unit, a third receiving unit, a second determining unit, a fourth transmitting unit, a fourth receiving unit and an establishing unit;
the third sending unit is configured to send a first internet protocol stack type to a first server; the first internet protocol stack type is determined by an internet protocol supported by the first terminal;
the third receiving unit is configured to receive a target penetration policy corresponding to a target internet protocol sent by the first server; the target penetration policy is determined by the first server according to the first internet protocol stack type and a second internet protocol stack type sent by a second terminal, the second internet protocol stack type is determined by an internet protocol supported by the second terminal, and the target internet protocol is an internet protocol supported by both the first terminal and the second terminal;
The second determining unit is used for determining a first address corresponding to the target penetration strategy;
the fourth sending unit is configured to send the first address to the first server; so that the first server sends the first address to the second terminal, and the second terminal penetrates through to the first terminal based on the first address;
the fourth receiving unit is configured to receive a second address, corresponding to the target penetration policy, of the second terminal, where the second address is sent by the first server;
the establishing unit is configured to penetrate through to the second terminal based on the second address until a direct link is established between the first terminal and the second terminal.
13. A computer device, the device comprising a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to execute the control method for direct link establishment according to any one of claims 1 to 3 or the direct link establishment method according to any one of claims 4 to 10 according to instructions in the program code.
14. A computer-readable storage medium storing a computer program for executing the control method of direct link establishment according to any one of claims 1 to 3 or the direct link establishment method according to any one of claims 4 to 10.
15. A computer program product comprising a computer program or instructions; the control method of direct link establishment according to any of the claims 1-3, or the direct link establishment method according to any of the claims 4-10, when said computer program or instructions are executed by a processor.
CN202210298786.4A 2022-03-23 2022-03-23 Control method for establishing direct link, direct link establishing method and related device Pending CN116846948A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210298786.4A CN116846948A (en) 2022-03-23 2022-03-23 Control method for establishing direct link, direct link establishing method and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210298786.4A CN116846948A (en) 2022-03-23 2022-03-23 Control method for establishing direct link, direct link establishing method and related device

Publications (1)

Publication Number Publication Date
CN116846948A true CN116846948A (en) 2023-10-03

Family

ID=88165779

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210298786.4A Pending CN116846948A (en) 2022-03-23 2022-03-23 Control method for establishing direct link, direct link establishing method and related device

Country Status (1)

Country Link
CN (1) CN116846948A (en)

Similar Documents

Publication Publication Date Title
US10959124B2 (en) Uplink data transmission method, terminal, network side device and system
CN113518085B (en) Data transmission method based on multiple channels and related device
KR102570017B1 (en) Session management method and device
CN106686070B (en) Database data migration method, device, terminal and system
CN109088799B (en) Client access method, device, terminal and storage medium
US10051607B2 (en) Data processing method, apparatus and system
WO2016112728A1 (en) Data transmission method, network server, user terminal and system
EP3179693B1 (en) Method, apparatus, storage medium and computer program product for establishing a data connection
US12010760B2 (en) Service-based communication method, unit, and system, and storage medium
US9307555B2 (en) Method and system for mobile terminal to access the network through cell phone
CN109862127B (en) Message transmission method and related device
CN111182580B (en) Service transmission method, terminal and network side equipment
WO2015090250A1 (en) Inter-process communication method and device
CN112291366A (en) Data transmission method, device, storage medium and electronic equipment
CN111444237A (en) Server system, data transmission method and electronic equipment
CN109951560B (en) Method, terminal and storage medium for improving concurrency and application speed of application service
CN109587028B (en) Method and device for controlling flow of client
CN106470234B (en) Equipment discovery method and device
WO2017031699A1 (en) Data transmission method, relevant device and system
CN110213069B (en) Data forwarding method and device, disaster recovery system and storage medium
CN116846948A (en) Control method for establishing direct link, direct link establishing method and related device
CN106330785B (en) Method and device for selecting service node
WO2024037515A1 (en) Message transmitting method, communication device, and storage medium
CN110870289B (en) Method and device for restoring surfing Internet of local area network equipment
CN109117630B (en) Method for reducing log loss, mobile terminal and readable storage medium

Legal Events

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