Relay connection establishment method and apparatus

By receiving and analyzing the discovery response messages from relay terminals, a relay connection is established with the terminal whose indication information has passed through the fewest relay terminals. This solves the problem of poor relay communication quality and achieves resource conservation and improved communication quality.

WO2025171758A9PCT designated stage Publication Date: 2026-05-21HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
HUAWEI TECH CO LTD
Filing Date
2025-01-13
Publication Date
2026-05-21

AI Technical Summary

Technical Problem

In existing technologies, relay terminals cannot be accurately selected during relay communication, resulting in poor communication quality and serious waste of wireless resources.

Method used

By receiving discovery response messages from multiple relay terminals, the system identifies the relay terminal with the smallest number of relay terminals through which the indication information passes and establishes a relay connection. The system then selects the relay terminal based on signal quality and lifetime value.

Benefits of technology

It improves the efficiency of relay connections, saves wireless resources, reduces loop overhead, and enhances the quality of relay communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025072056_21052026_PF_FP_ABST
    Figure CN2025072056_21052026_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the embodiments of the present application are a relay connection establishment method and apparatus. The method comprises: receiving first information, wherein the first information comprises a discovery response message sent by each of a plurality of relay terminals, the discovery response message is a response message for a first discovery message, the discovery response message comprises first indication information and first discovery information, the first indication information is used for indicating a relay terminal through which the first discovery information passes, the first discovery information comprises a terminal identifier and a relay service code, and the first discovery message is used by a first terminal to discover a second terminal; on the basis of the first information, determining a first relay terminal, wherein the first relay terminal is one of the plurality of relay terminals; and sending a connection message to the first relay terminal, wherein the connection message comprises the terminal identifier and second indication information, and the second indication information is the first indication information in the discovery response message sent by the first relay terminal. The present application improves the quality of relay communication.
Need to check novelty before this filing date? Find Prior Art

Description

Relay connection establishment method and apparatus

[0001] This application claims priority to Chinese Patent Application No. 202410180844.2, filed on February 15, 2024, entitled “Method and Apparatus for Establishing Relay Connection”, the entire contents of which are incorporated herein by reference. Technical Field

[0002] This application relates to communication technology, and more particularly to a method and apparatus for establishing a relay connection. Background Technology

[0003] With the development of communication technology, proximity services allow user equipment (UEs) to communicate directly, enabling UEs to communicate or access the network through other UEs even in the absence of wireless network coverage. UEs connect via the Proximity Communications 5 (PC5) interface, and direct PC5 communication can begin after mutual discovery. However, when two end UEs requiring end-to-end (UE-to-UE, U2U) PC5 communication cannot establish a direct PC5 connection, one or more intermediate UEs can act as relays, forwarding communication signals or data to these two UEs, thus indirectly establishing a PC5 connection. Similarly, when a remote UE requiring end-to-network (UE-to-Network, U2N) communication cannot establish a direct air interface (Uu interface) connection, one or more intermediate UEs can act as relays, forwarding communication signals or data to the remote UE, thus indirectly enabling this UE to access the network.

[0004] In existing technologies, the first relay terminal is selected mainly based on the signal quality or time-to-live (TTL) value of the discovery signal or discovery response signal, and a relay connection is further established by combining the layer 2 address association relationship of the relay address.

[0005] However, in the existing technology, when selecting the first relay terminal by signal quality or time-to-live (TTL) value, it is impossible to accurately select the relay terminal on the connection path to the communication target. Furthermore, the overhead of avoiding loops by using the TTL value is relatively large, which further reduces the quality of relay communication. Summary of the Invention

[0006] This application provides a method and apparatus for establishing a relay connection to solve the problem of poor relay communication quality.

[0007] In a first aspect, this application provides a relay connection establishment method, comprising: receiving first information; wherein the first information includes a discovery response message sent by each of a plurality of relay terminals; the discovery response message is a response message to a first discovery message; the discovery response message includes first indication information and first discovery information; the first indication information is used to indicate the relay terminal through which the first discovery information passes; the first discovery information includes: a terminal identifier and a relay service code; the first discovery message is used by a first terminal to discover a second terminal; determining a first relay terminal based on the first information, wherein the first relay terminal is one of the plurality of relay terminals; sending a connection message to the first relay terminal; the connection message includes: a terminal identifier and second indication information; the second indication information is the first indication information in the discovery response message sent by the first relay terminal.

[0008] This application determines a first relay terminal by receiving first information, which includes discovery response messages sent by each of a plurality of relay terminals, and further sends a connection message to the first terminal to establish a relay connection between the first terminal and a second terminal. The discovery response messages in the first information include indications of the relay terminals through which the first discovery information has passed. Therefore, in determining the first relay terminal based on the first information, the discovery response message with the smallest number of relay terminals through which the first discovery information indicated by the first indication information has passed can be selected, and the relay terminal sending that discovery response message can be identified as the first relay terminal. This improves relay connection efficiency and further conserves wireless resources in relay communication.

[0009] In one possible implementation, determining the first relay terminal based on the first information includes: determining the first relay terminal based on the first indication information in the first information.

[0010] In one possible implementation, the discovery response message further includes a time-to-live value; and / or, the first information further includes the signal quality of the discovery response message; the time-to-live value is the numerical value of the time-to-live when the first discovery message corresponding to the discovery response message is responded to.

[0011] In one possible implementation, determining the first relay terminal based on the first information includes: determining the first relay terminal based on one or more of the following: a time-to-live value in the first information, the signal quality of the discovery response message, and preset third indication information, and the first indication information; the preset third indication information is used to indicate the relay terminal that the first terminal wishes to select.

[0012] In one possible implementation, the method further includes: broadcasting the first discovery message; the first discovery message includes: first discovery information, first hop count information, and first indication information; wherein the first hop count information is used to limit the maximum number of hops for transmitting the first discovery information; and the first indication information is used to indicate the relay terminals through which the first discovery information passes.

[0013] In one possible implementation, the method further includes: receiving a connection response message sent by the first relay terminal; wherein the connection response message is a response message to the connection message.

[0014] In one possible implementation, the terminal identifier includes: a first terminal identifier and a second terminal identifier, or the terminal identifier includes: a first terminal identifier.

[0015] Secondly, this application provides a relay connection establishment method, comprising: receiving second information; wherein the second information includes a second discovery message broadcast by each of a plurality of relay terminals; the second discovery message is used by a first terminal to discover a second terminal; the second discovery message originates from a relay terminal, and includes: fourth indication information and second discovery information; the fourth indication information is used to indicate the relay terminal through which the second discovery information passes; the second discovery information includes: a terminal identifier and a relay service code; the second discovery information originates from a second terminal; determining a first relay terminal based on the second information, wherein the first relay terminal is one of the plurality of relay terminals; sending a connection message to the first relay terminal; the connection message includes: a terminal identifier and fifth indication information; the fifth indication information is the fourth indication information in the second discovery message sent by the first relay terminal.

[0016] This application determines a first relay terminal by receiving second information, including second discovery messages sent by each of a plurality of relay terminals, and further sends a connection message to the first terminal to establish a relay connection between the first terminal and the second terminal. The second discovery messages in the second information include indications of the relay terminals traversed by the second discovery information. Therefore, in determining the first relay terminal based on the second information, the second discovery message with the smallest number of relay terminals traversed by the second discovery information indicated by the fourth indication information can be selected, and the relay terminal sending the second discovery message can be identified as the first relay terminal. This improves relay connection efficiency and further conserves wireless resources in relay communication.

[0017] In one possible implementation, determining the first relay terminal based on the second information includes: determining the first relay terminal based on the fourth indication information in the second information.

[0018] In one possible implementation, the second discovery message further includes second hop count information; and / or the second information further includes the signal quality of the second discovery message; the second hop count information is used to limit the maximum number of hops for transmitting the second discovery information.

[0019] In one possible implementation, determining the first relay terminal based on the second information includes: determining the first relay terminal based on one or more of the second hop count information, the signal quality of the second discovery message, and preset third indication information, and fourth indication information in the second information; the preset third indication information is used to indicate the relay terminal that the first terminal wishes to select.

[0020] In one possible implementation, the method further includes: receiving a connection response message sent by the first relay terminal; wherein the connection response message is a response message to the connection message.

[0021] In one possible implementation, the terminal identifier includes: a first terminal identifier and a second terminal identifier, or the terminal identifier includes: a first terminal identifier.

[0022] Thirdly, this application provides a relay connection establishment method, comprising: receiving a connection message sent by a first terminal or other relay terminals; the connection message comprising: a terminal identifier and second indication information; the second indication information being first indication information in a discovery response message sent by the first relay terminal; the first relay terminal being a relay terminal determined according to first information, the first information being information received by the first terminal including discovery response messages sent by each of a plurality of relay terminals; determining, according to the second indication information, that the connection message will be sent to other relay terminals or a second terminal, and sending the connection message to them.

[0023] This application receives a connection message sent by a first terminal or other relay terminal, and determines, according to the second indication information, to send the connection message to other relay terminals or a second terminal, and sends the connection message to them. In this way, determining the first discovery message to be sent according to the number of relay terminals indicated by the first indication information can save wireless resources for relay connection establishment and relay communication.

[0024] In one possible implementation, determining, based on the second indication information, that the connection message will be sent to another relay or a second terminal, and sending the connection message to it, includes: unicasting the connection message to another relay terminal if it is determined that the connection message will be sent to it based on the second indication information; and sending the connection message to a second terminal device based on the type of the second terminal device if it is determined that the connection message will be sent to it based on the second indication information; wherein the type of the second terminal device includes: relay device and terminal device.

[0025] In one possible implementation, sending a connection message to the second terminal device based on its type includes: if the second terminal device is a relay device, then unicasting the connection message to it; if the second terminal device is a terminal device, then broadcasting the connection message.

[0026] In one possible implementation, the method further includes: receiving a discovery response message sent by a second terminal or other relay terminal; the discovery response message is a response message to a first discovery message; the discovery response message includes first indication information and first discovery information; the first indication information is used to indicate the relay terminal through which the first discovery information passes; the first discovery information includes: a terminal identifier and a relay service code; the first discovery message is used by the first terminal to discover the second terminal; and the discovery response message is sent to the corresponding other relay terminal or the first terminal according to the Layer 2 address association relationship.

[0027] In one possible implementation, the method further includes: receiving third information; wherein the third information includes a first discovery message broadcast by a first terminal or other relay terminal; the first discovery message includes: first discovery information, first hop count information, and first indication information; wherein the first hop count information is used to limit the maximum number of hops for transmitting the first discovery information; the first indication information is used to indicate the relay terminal through which the first discovery information passes; and determining and broadcasting the first discovery message to be sent based on the third information.

[0028] In one possible implementation, the third information further includes the signal quality of the first discovery message; determining and broadcasting the first discovery message to be sent based on the third information includes: determining and broadcasting the first discovery message to be sent based on one or more of the first hop count information, the signal quality of the first discovery message, and the first indication information.

[0029] In one possible implementation, the method further includes: receiving a connection response message sent by a second terminal or other relay terminal; wherein the connection response message is a response message to the connection message; the connection response message includes: a terminal identifier and an identifier of the relay terminal that sent the connection response message; and sending the connection response message to a first terminal or other relay terminal according to the terminal identifier included in the connection response message and the identifier of the relay terminal that received the connection response message.

[0030] In one possible implementation, the terminal identifier includes: a first terminal identifier and a second terminal identifier, or the terminal identifier includes: a first terminal identifier.

[0031] Fourthly, this application provides a relay connection establishment method, comprising: receiving a connection message sent by a first terminal or another relay terminal; the connection message comprising: a terminal identifier and fifth indication information; the fifth indication information being the fourth indication information in a second discovery message sent by the first relay terminal; determining, based on the fifth indication information, to send the connection message to another relay or a second terminal, and sending the connection message to it.

[0032] This application receives a connection message sent by a first terminal or other relay terminal, and determines, according to the fifth indication information, to which the connection message will be sent, other relay or second terminal, and sends the connection message to them. In this way, determining the relay terminal or second terminal to which the message will be sent according to the fifth indication information in the connection message improves the accuracy of relay connection, saves signaling overhead in the connection establishment process, and further improves the quality of relay communication.

[0033] In one possible implementation, determining, based on the fifth indication information, that the connection message will be sent to another relay or second terminal, and sending the connection message to it, includes: unicasting the connection message to another relay terminal if it is determined that the connection message will be sent to it; and sending the connection message to a second terminal device according to the type of the second terminal device if it is determined that the connection message will be sent to it; wherein the type of the second terminal device includes relay devices and terminal devices.

[0034] In one possible implementation, sending a connection message to the second terminal device based on its type includes: if the second terminal device is a relay device, then unicasting the connection message to it; if the second terminal device is a relay device, then broadcasting the connection message.

[0035] In one possible implementation, the method further includes: generating and broadcasting a second discovery message; the second discovery message is used by the first terminal to discover the second terminal; the second discovery message includes: fourth indication information and second discovery information; the fourth indication information is used to indicate the relay terminal through which the second discovery information passes; the second discovery information includes: terminal identifier and relay service code; the second discovery information originates from the second terminal.

[0036] In one possible implementation, the method further includes: receiving fourth information; wherein the fourth information includes a second discovery message broadcast by each of a plurality of other relay terminals; and determining and broadcasting a second discovery message to be sent based on the fourth information.

[0037] In one possible implementation, determining and broadcasting the second discovery message to be sent based on the fourth information includes: determining and broadcasting the second discovery message to be sent based on the fourth indication information.

[0038] In one possible implementation, the second discovery message further includes second hop count information; and / or the fourth information further includes the signal quality of the second discovery message; the second hop count information is used to limit the maximum number of hops for transmitting the second discovery information; determining and broadcasting the second discovery message to be sent according to the fourth information includes: determining and broadcasting the second discovery message to be sent according to one or more of the second hop count information and the signal quality of the second discovery message in the fourth information, and the fourth indication information.

[0039] In one possible implementation, the method further includes: receiving a connection response message sent by a second terminal or other relay terminal; wherein the connection response message is a response message to the connection message; the connection response message includes: a terminal identifier and an identifier of the relay terminal that sent the connection response message; and sending the connection response message to a first terminal or other relay terminal according to the terminal identifier and the identifier of the relay terminal that sent the connection response message.

[0040] In one possible implementation, the terminal identifier includes: a first terminal identifier and a second terminal identifier, or the terminal identifier includes: a first terminal identifier.

[0041] Fifthly, this application provides a relay connection establishment method, comprising: receiving a connection message sent by a relay terminal; the connection message including: a terminal identifier and second indication information; the second indication information being first indication information in a discovery response message sent by a first relay terminal; the first relay terminal being a relay terminal determined according to first information, the first information being information received by the first terminal including discovery response messages sent by each of a plurality of relay terminals; generating a connection response message corresponding to the connection message according to the terminal identifier and second indication information included in the connection message, and determining the relay terminal corresponding to the connection response message; and sending the connection response message to the relay terminal corresponding to the connection response message.

[0042] This application receives a connection message sent by a relay terminal, generates a connection response message corresponding to the connection message based on the terminal identifier and second indication information included in the connection message, and determines the relay terminal corresponding to the connection response message; then sends the connection response message to the relay terminal corresponding to the connection response message. In this way, determining the terminal to which the message is to be sent based on the second indication information in the connection message improves the accuracy of relay connections, saves signaling overhead in the connection establishment process, and further improves the quality of relay communication.

[0043] In one possible implementation, the connection response message includes a terminal identifier, an identifier of the second terminal or relay terminal that sent the connection response message, and an identifier of the relay terminal or the first terminal that received the connection response message.

[0044] In one possible implementation, the method further includes: receiving fifth information; wherein the fifth information includes a first discovery message broadcast by each of a plurality of relay terminals, the first discovery message including: first discovery information, first hop count information, and first indication information; wherein the first hop count information is used to limit the maximum number of hops for transmitting the first discovery information; the first indication information is used to indicate the relay terminals traversed by the first discovery information; determining a first discovery message to be responded to based on the fifth information; generating a discovery response message for the first discovery message to be responded to; the discovery response message including first indication information and first discovery information; the first indication information is used to indicate the relay terminals traversed by the first discovery information; the first discovery information includes: terminal identifier and relay service code; and sending the discovery response message to the corresponding relay terminal according to the Layer 2 address association relationship.

[0045] In one possible implementation, determining the first discovery message to be responded to based on the fifth information includes: determining the first discovery message to be responded to based on the first hop count information and / or the first indication information.

[0046] In one possible implementation, the fifth piece of information also includes the signal quality of the first discovery message.

[0047] In one possible implementation, determining the first discovery message to be responded to based on the fifth information includes: determining the first discovery message to be responded to based on one or more of the first hop count information, the signal quality of the first discovery message, and preset sixth indication information, and the first indication information; the preset sixth indication information is used to indicate the relay terminal that the second terminal expects to select.

[0048] In one possible implementation, the terminal identifier includes: a first terminal identifier and a second terminal identifier, or the terminal identifier includes: a first terminal identifier.

[0049] Sixthly, this application provides a relay connection establishment method, comprising: receiving a connection message sent by a relay terminal; the connection message including: a terminal identifier and fifth indication information; the fifth indication information being fourth indication information in a second discovery message sent by a first relay terminal; the first relay terminal being a relay terminal determined according to second information, the second information being information received by the first terminal including second discovery messages sent by each of a plurality of relay terminals; generating a connection response message corresponding to the connection message according to the terminal identifier and the fifth indication information included in the connection message, and determining the relay terminal corresponding to the connection response message; and sending the connection response message to the relay terminal corresponding to the connection response message.

[0050] This application receives a connection message sent by a relay terminal, generates a connection response message corresponding to the connection message based on the terminal identifier and fifth indication information included in the connection message, and determines the relay terminal corresponding to the connection response message; then sends the connection response message to the relay terminal corresponding to the connection response message. In this way, determining the terminal to which the message is to be sent based on the fifth indication information in the connection message improves the accuracy of relay connections, saves signaling overhead in the connection establishment process, and further improves the quality of relay communication.

[0051] In one possible implementation, the connection response message includes: a terminal identifier, an identifier of the second terminal or relay terminal that sent the connection response message, and an identifier of the relay terminal or the first terminal that received the connection response message.

[0052] In one possible implementation, the terminal identifier includes: a first terminal identifier and a second terminal identifier, or the terminal identifier includes: a first terminal identifier.

[0053] In a seventh aspect, this application provides a relay connection establishment device, including: a transceiver unit and a processing unit;

[0054] The transceiver unit is configured to receive first information; wherein the first information includes a discovery response message sent by each of a plurality of relay terminals; the discovery response message is a response message to the first discovery message; the discovery response message includes first indication information and first discovery information; the first indication information is used to indicate the relay terminal through which the first discovery information passes; the first discovery information includes: terminal identifier and relay service code; the first discovery message is used by the first terminal to discover the second terminal;

[0055] The processing unit is configured to determine a first relay terminal based on the first information, wherein the first relay terminal is one of the plurality of relay terminals; and send a connection message to the first relay terminal; the connection message includes: a terminal identifier and second indication information; the second indication information is the first indication information in a discovery response message sent by the first relay terminal.

[0056] This application determines a first relay terminal by receiving first information, which includes discovery response messages sent by each of a plurality of relay terminals, and further sends a connection message to the first terminal to establish a relay connection between the first terminal and a second terminal. The discovery response messages in the first information include indications of the relay terminals through which the first discovery information has passed. Therefore, in determining the first relay terminal based on the first information, the discovery response message with the smallest number of relay terminals through which the first discovery information indicated by the first indication information has passed can be selected, and the relay terminal sending that discovery response message can be identified as the first relay terminal. This improves relay connection efficiency and further conserves wireless resources in relay communication.

[0057] Eighthly, this application provides a relay connection establishment device, including: a transceiver unit and a processing unit;

[0058] The transceiver unit is used to receive second information; wherein the second information includes a second discovery message broadcast by each of the plurality of relay terminals; the second discovery message is used by the first terminal to discover the second terminal; the second discovery message originates from the relay terminal, and the second discovery message includes: fourth indication information and second discovery information; the fourth indication information is used to indicate the relay terminal through which the second discovery information passes; the second discovery information includes: terminal identifier and relay service code; the second discovery information originates from the second terminal;

[0059] The processing unit is configured to determine a first relay terminal based on the second information, wherein the first relay terminal is one of the plurality of relay terminals; and send a connection message to the first relay terminal; the connection message includes: a terminal identifier and fifth indication information; the fifth indication information is the fourth indication information in the second discovery message sent by the first relay terminal.

[0060] This application determines a first relay terminal by receiving second information, including second discovery messages sent by each of a plurality of relay terminals, and further sends a connection message to the first terminal to establish a relay connection between the first terminal and the second terminal. The second discovery messages in the second information include indications of the relay terminals traversed by the second discovery information. Therefore, in determining the first relay terminal based on the second information, the second discovery message with the smallest number of relay terminals traversed by the second discovery information indicated by the fourth indication information can be selected, and the relay terminal sending the second discovery message can be identified as the first relay terminal. This improves relay connection efficiency and further conserves wireless resources in relay communication.

[0061] Ninthly, this application provides a method for establishing a relay connection, comprising: a transceiver unit and a processing unit;

[0062] The transceiver unit is configured to receive connection messages sent by a first terminal or other relay terminals; the connection message includes: a terminal identifier and second indication information; the second indication information is first indication information in a discovery response message sent by the first relay terminal; the first relay terminal is a relay terminal determined according to first information, and the first information is information received by the first terminal including discovery response messages sent by each of a plurality of relay terminals;

[0063] The processing unit is configured to determine, based on the second indication information, to other relay terminals or a second terminal to which the connection message will be sent, and to send the connection message to them.

[0064] This application receives a connection message sent by a first terminal or other relay terminal, and determines, according to the second indication information, to send the connection message to other relay terminals or a second terminal, and sends the connection message to them. In this way, determining the first discovery message to be sent according to the number of relay terminals indicated by the first indication information can save wireless resources for relay connection establishment and relay communication.

[0065] In a tenth aspect, this application provides a method for establishing a relay connection, comprising: a transceiver unit and a processing unit;

[0066] The transceiver unit is used to receive connection messages sent by a first terminal or other relay terminals; the connection message includes: a terminal identifier and fifth indication information; the fifth indication information is the fourth indication information in the second discovery message sent by the first relay terminal;

[0067] The processing unit is configured to determine, based on the fifth indication information, to which the connection message will be sent, other relays or second terminals, and to send the connection message to them.

[0068] This application receives a connection message sent by a first terminal or other relay terminal, and determines, according to the fifth indication information, to which the connection message will be sent, other relay or second terminal, and sends the connection message to them. In this way, determining the relay terminal or second terminal to which the message will be sent according to the fifth indication information in the connection message improves the accuracy of relay connection, saves signaling overhead in the connection establishment process, and further improves the quality of relay communication.

[0069] In one aspect, this application provides a method for establishing a relay connection, comprising: a transceiver unit and a processing unit;

[0070] The transceiver unit is used to receive a connection message sent by a relay terminal; the connection message includes: a terminal identifier and second indication information; the second indication information is the first indication information in a discovery response message sent by a first relay terminal; the first relay terminal is a relay terminal determined according to the first information, and the first information is information received by the first terminal including discovery response messages sent by each of a plurality of relay terminals;

[0071] The processing unit is configured to generate a connection response message corresponding to the connection message based on the terminal identifier and the second indication information included in the connection message, and determine the relay terminal corresponding to the connection response message; and send the connection response message to the relay terminal corresponding to the connection response message.

[0072] This application receives a connection message sent by a relay terminal, generates a connection response message corresponding to the connection message based on the terminal identifier and second indication information included in the connection message, and determines the relay terminal corresponding to the connection response message; then sends the connection response message to the relay terminal corresponding to the connection response message. In this way, determining the terminal to which the message is to be sent based on the second indication information in the connection message improves the accuracy of relay connections, saves signaling overhead in the connection establishment process, and further improves the quality of relay communication.

[0073] In a twelfth aspect, this application provides a method for establishing a relay connection, comprising: a transceiver unit and a processing unit;

[0074] The transceiver unit is used to receive a connection message sent by a relay terminal; the connection message includes: a terminal identifier and fifth indication information; the fifth indication information is the fourth indication information in the second discovery message sent by the first relay terminal; the first relay terminal is a relay terminal determined according to the second information, and the second information is information received by the first terminal including the second discovery message sent by each of the multiple relay terminals;

[0075] The processing unit is configured to generate a connection response message corresponding to the connection message based on the terminal identifier and the fifth indication information included in the connection message, and determine the relay terminal corresponding to the connection response message; and send the connection response message to the relay terminal corresponding to the connection response message.

[0076] This application receives a connection message sent by a relay terminal, generates a connection response message corresponding to the connection message based on the terminal identifier and fifth indication information included in the connection message, and determines the relay terminal corresponding to the connection response message; then sends the connection response message to the relay terminal corresponding to the connection response message. In this way, determining the terminal to which the message is to be sent based on the fifth indication information in the connection message improves the accuracy of relay connections, saves signaling overhead in the connection establishment process, and further improves the quality of relay communication.

[0077] In a thirteenth aspect, this application provides a relay connection establishment device, including: a processor, a memory, and a communication interface;

[0078] The memory is used to store computer-executable program code, the program code including instructions; when the processor executes the instructions, the instructions cause the terminal device to perform the method described in the first aspect above, or, perform the method described in the second aspect above, or, perform the method described in the third aspect above, or, perform the method described in the fourth aspect above, or, perform the method described in the fifth aspect above, or, perform the method described in the sixth aspect above.

[0079] In a fourteenth aspect, a computer storage medium is provided, wherein program code is stored therein, the program code being used to instruct instructions for performing the methods of the first, second, third, fourth, fifth, sixth aspects or any possible implementation thereof.

[0080] In a fifteenth aspect, a processor is provided for coupling with a memory for performing the methods described in the first, second, third, fourth, fifth, and sixth aspects or any possible implementation thereof.

[0081] In a sixteenth aspect, a computer program product containing instructions is provided, which, when run on a computer, causes the computer to perform the methods of the first, second, third, fourth, fifth, and sixth aspects or any possible implementation thereof.

[0082] In a seventeenth aspect, a computer storage medium is provided, wherein program code is stored therein, the program code being used to instruct instructions for performing the methods of the first, second, third, fourth, fifth, sixth aspects or any possible implementation thereof. Attached Figure Description

[0083] Figure 1 is a schematic diagram of an application scenario provided by an embodiment of this application;

[0084] Figure 2 is a schematic diagram of another application scenario provided by an embodiment of this application;

[0085] Figure 3 is a flowchart of a relay connection establishment method provided in an embodiment of this application;

[0086] Figure 4 is a signaling diagram of a relay connection establishment method provided in an embodiment of this application;

[0087] Figure 5 is a signaling diagram of another relay connection establishment method provided in the embodiments of this application;

[0088] Figure 6 is a signaling diagram of another relay connection establishment method provided in an embodiment of this application;

[0089] Figure 7 is a signaling diagram of another relay connection establishment method provided in an embodiment of this application;

[0090] Figure 8 is a flowchart of another relay connection establishment method provided in an embodiment of this application;

[0091] Figure 9 is a flowchart of another relay connection establishment method provided in an embodiment of this application;

[0092] Figure 10 is a flowchart of another relay connection establishment method provided in an embodiment of this application;

[0093] Figure 11 is a flowchart of another relay connection establishment method provided in an embodiment of this application;

[0094] Figure 12 shows a schematic block diagram of a relay connection establishment device 1200 on the first terminal side according to an embodiment of this application;

[0095] Figure 13 shows a schematic block diagram of a relay connection establishment device 1300 on the relay terminal side according to an embodiment of this application;

[0096] Figure 14 shows a schematic block diagram of a relay connection establishment device 1400 on the second terminal side according to an embodiment of this application;

[0097] Figure 15 shows a schematic block diagram of a relay connection establishment device 1500 on the first terminal side according to an embodiment of this application;

[0098] Figure 16 shows a schematic block diagram of a relay connection establishment device 1600 on the relay terminal side according to an embodiment of this application;

[0099] Figure 17 shows a schematic block diagram of a relay connection establishment device 1700 on the second terminal side according to an embodiment of this application. Detailed Implementation

[0100] The technical solution provided in this application will now be described with reference to the accompanying drawings.

[0101] To facilitate understanding of the embodiments of this application, the following points will be explained first:

[0102] First, in this application, the indication includes explicit indication (also known as direct indication) and implicit indication (also known as indirect indication). Explicit indication information A means including information A; implicit indication information A means indicating information A through the correspondence between information A and information B, and direct indication information B. The correspondence between information A and information B can be predefined, pre-stored, pre-burned, or pre-configured; or it can refer to indicating information A through information B and preset rules.

[0103] Second, in this application, information C is used to determine information D, which includes both determining information D based solely on information C and determining it based on information C and other information. Furthermore, information C can also be used to determine information D indirectly, for example, in the case where information D is determined based on information E, and information E is determined based on information C.

[0104] Third, in this application, "at least one" means one or more, and "more than one" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates an "or" relationship between the preceding and following related objects, but it does not exclude the possibility of indicating an "and" relationship; the specific meaning can be understood in context. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c; a and b; a and c; b and c; or a and b and c. Here, a, b, and c can be single or multiple.

[0105] Fourth, in this application, the use of prefixes such as "first" and "second" is merely for the purpose of distinguishing and describing different things belonging to the same category, and does not constrain the order, size, or quantity of things. For example, "first information" and "second information" are simply different pieces of information, and there is no temporal sequence, size, or priority relationship between them.

[0106] Fifth, in this application, "send" and "receive" indicate the direction of signal transmission. For example, "send information to the terminal" can be understood as the destination of the information being the terminal, which may include direct transmission via the air interface or indirect transmission via the air interface by other units or modules. "Receive information from a network device" can be understood as the source of the information being the network device, which may include direct reception from the network device via the air interface or indirect reception from the network device via the air interface by other units or modules. "Send" can also be understood as the "output" of the chip interface, and "receive" can also be understood as the "input" of the chip interface.

[0107] In other words, sending and receiving can occur between devices, such as between a terminal and a network device; or they can occur within a device, such as between components, modules, chips, software modules, or hardware modules within a device via a bus, wiring, or interface.

[0108] Sixth, in the embodiments of this application, "when," "if," and "if" all refer to the device making corresponding processing under certain objective circumstances, and are not limited to a time, nor do they require the device to make a judgment action when it is implemented, nor do they mean that there are other limitations.

[0109] Seventh, in this application, the words "example," "exemplarily," "for example," or "such as" are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "example," "exemplarily," "for example," or "such as" in this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of the words "example," "exemplarily," "for example," or "such as" is intended to present the relevant concepts in a specific manner.

[0110] Eighth, this paper describes the method provided in this application using downlink channel measurement as an example, but this should not limit the scenarios to which this solution is applicable. In uplink channel measurement, the network device can also configure a reference signal resource group corresponding to multiple CCs for the terminal, and then receive reference signals on multiple reference signal resources in the reference signal resource group, and perform channel measurement and reporting. Based on the same concept, those skilled in the art can make simple modifications to the embodiments in this paper to obtain the uplink channel measurement process, which will not be elaborated here for the sake of brevity.

[0111] The technical solutions provided in this application can be applied to various communication systems, such as: Long Term Evolution (LTE) systems, LTE Frequency Division Duplex (FDD) systems, LTE Time Division Duplex (TDD) systems, sidelink (SL) communication systems, Universal Mobile Telecommunication System (UMTS), Worldwide Interoperability for Microwave Access (WiMAX) communication systems, 5th Generation (5G) mobile communication systems, or new radio access technology (NR). Among these, 5G mobile communication systems can include non-standalone (NSA) and / or standalone (SA) networking. The technical solutions provided in this application can also be applied to future communication systems, such as 6th Generation (6G) mobile communication systems. This application does not limit these applications.

[0112] Figure 1 is a schematic diagram of an application scenario provided by an embodiment of this application. As shown in Figure 1, when a terminal device performs terminal-to-terminal (UE-to-UE, U2U) communication through a relay connection, the network architecture of the application scenario includes a first terminal, a second terminal, and one or more relay terminals. The first terminal communicates with the second terminal through one or more relay terminals. The first terminal is the source terminal (Source UE) of the relay connection, and the second terminal is the target terminal (Target UE) of the relay connection. The source terminal (Source UE) is the terminal that initiates the relay connection, and the target terminal (Target UE) is the terminal that accepts the relay connection. The first terminal can also be the target terminal (Target UE) in other relay connections or relay communication processes, and similarly, the second terminal can also be the source terminal (Source UE) in other relay connections or relay communication processes. For example, as shown in Figure 1, the first terminal UE1 establishes a communication connection with the second terminal UE2 through the first relay terminal R1, the second relay terminal R2, and the third relay terminal R3 to complete the relay connection method of this application.

[0113] Figure 2 illustrates another application scenario provided by an embodiment of this application. As shown in Figure 1, when a terminal device performs UE-to-Network (U2N) communication via a relay connection, the network architecture of the application scenario includes a network device, a first terminal, a second terminal, and one or more relay terminals. The first terminal establishes a communication connection with the network device through one or more relay terminals and a second terminal. The first terminal is the remote terminal (Remote UE) of the relay connection, and the second terminal is a relay terminal already connected to the network device. For example, as shown in Figure 2, the first terminal UE1 establishes a communication connection with the second terminal UE2 through the first relay terminal R1, the second relay terminal R2, and the third relay terminal R3 to complete the relay connection method of this application. The second terminal UE2 and the network device A have already established a network connection.

[0114] In the embodiments of this application, the terminal and network device can be hardware devices, or software functions running on dedicated hardware, or software functions running on general-purpose hardware, such as virtualization functions instantiated on a platform (e.g., cloud platform), or entities that include dedicated or general-purpose hardware devices and software functions. This application does not limit the specific form of the terminal and network device.

[0115] To better understand the methods provided in the embodiments of this application, the terms involved in this application will be briefly explained below.

[0116] A terminal, also known as a terminal device, user equipment (UE), mobile station, or mobile terminal, can be widely used in various scenarios, such as device-to-device (D2D), vehicle-to-everything (V2X) communication, machine-type communication (MTC), the Internet of Things (IoT), virtual reality, augmented reality, industrial control, autonomous driving, telemedicine, smart grids, smart furniture, smart offices, smart wearables, smart transportation, and smart cities. Terminals can be mobile phones, tablets, computers with wireless transceiver capabilities, wearable devices, vehicles, drones, helicopters, airplanes, ships, robots, robotic arms, smart home devices, etc.

[0117] Access network equipment refers to the access equipment that enables terminals to access wireless networks wirelessly, or in other words, the radio access network (RAN) node (or equipment) that connects terminals to wireless networks. The access network equipment can be an evolved node B (eNB), radio network controller (RNC), node B (NB), base station controller (BSC), base transceiver station (BTS), home base station (e.g., home evolved node B, or Home Node B, HNB), baseband unit (BBU), access point (AP), wireless relay node, wireless backhaul node, transmission point (TP), or transmission and reception point (TRP) in a wireless fidelity (WIFI) system. It can also be a network device or transmission point (TRP or TP) in a 5G (e.g., NR) system, or one or a group of antenna panels (including multiple antenna panels) of a base station in a 5G system, or a network node constituting a network device or transmission point, such as a baseband unit (BBU) or a distributed unit (DMU). The embodiments of this application do not limit the specific technology or device form used in the wireless access network equipment. In the embodiments of this application, the access network equipment may also be referred to as network equipment or base station. Unless otherwise specified, in the embodiments of this application, network equipment refers to access network equipment.

[0118] Proximity Service (ProSe) allows user equipment (UE) to communicate directly, enabling UEs to communicate or access the network through other UEs even in the absence of wireless network coverage. ProSe communication is currently used in 5G systems. ProSe UEs connect via the Proximity Communications 5 (PC5) interface, and direct PC5 communication can commence after mutual discovery between UEs.

[0119] Terminal-to-terminal (UE-to-UE, U2U) data transmission between a source terminal and a target terminal is carried out through a relay terminal.

[0120] UE-to-Network (U2N) uses relay terminals to transmit data between remote terminals and network devices.

[0121] The method provided in this application will now be described in detail with reference to the accompanying drawings.

[0122] Figure 3 is a flowchart of a relay connection establishment method provided in an embodiment of this application. As shown in Figure 3, the relay connection establishment method provided in this embodiment of the application is executed by a first terminal, and the method includes:

[0123] S101, The first terminal receives the first information.

[0124] The first information includes a discovery response message sent by each of the multiple relay terminals; the discovery response message is a response message to the first discovery message; the first discovery message is used by the first terminal to discover the second terminal.

[0125] In this embodiment, the first discovery message is a discovery message broadcast by the first terminal to discover the second terminal. In one example, if the first discovery message is directly received by the second terminal, the first terminal can discover the second terminal without a relay terminal. That is, in U2U communication, the source terminal directly discovers the target terminal; in U2N communication, the remote terminal directly discovers the relay terminal already connected to the network device. After receiving the first discovery message, the second terminal generates a corresponding discovery response message and sends it back to the first terminal. In one example, if the first discovery message broadcast by the first terminal is not directly received by the second terminal but by a relay terminal, the relay terminal adds its own identity information, such as a user info ID, to the first discovery message and then broadcasts it again until it is received by the second terminal. After receiving the first discovery message, the second terminal generates a corresponding discovery response message and sends it to the relay terminal that sent the first discovery message via unicast. Then, the relay terminal that receives the discovery response message continues to send it via unicast to the relay terminal that sent the first discovery message to it, until the response message is sent to the first terminal. In this embodiment, the first discovery message broadcast by the first terminal is received by the second terminal after being received and forwarded by different relay terminals. That is, the first terminal discovers the second terminal through different relay terminals, and the second terminal generates response messages for the received first discovery messages and sends them to the first terminal through the relay terminals through which the first discovery message passed. In this embodiment, the discovery response messages included in the first information are all discovery response messages corresponding to the first discovery message received by the first terminal.

[0126] The discovery response message includes first indication information and first discovery information; the first indication information is used to indicate the relay terminal through which the first discovery information passes; the first discovery information includes: terminal identifier and relay service code;

[0127] In this embodiment, the terminal identifier refers to the identifier of the terminal that needs to perform a relay connection before the relay connection is established. Optionally, the terminal identifier can be the user information identifier (User Info ID) of the terminal. Specifically, in U2U communication, the terminals that need to perform a relay connection include the source terminal and the destination terminal. Therefore, for the scenario shown in Figure 1, the terminal identifier includes the identifier of the first terminal and the identifier of the second terminal. Specifically, in U2N communication, the terminals that need to perform a relay connection only include the remote terminal. Therefore, for the scenario shown in Figure 2, the terminal identifier includes the identifier of the first terminal. In this embodiment, the Relay Service Code (RSC) is a pre-configured relay service code before the relay connection is established, used to characterize the type of relay service. In this embodiment, the first discovery information is information that has been determined before the relay connection is established. The first discovery information is included in the discovery message broadcast by the first terminal to discover the second terminal, i.e., the first discovery message. The first discovery information is also included in the response message of the first discovery message, i.e., the discovery response message.

[0128] In this embodiment, the first indication information is used to indicate the relay terminals through which the first discovery information passes. For example, the first indication information may include the User Info ID of the relay terminals through which the first discovery information passes. Specifically, in the first discovery message, the first indication information indicates the relay terminals through which the first discovery information passes, and the first indication information is updated as different relay terminals receive and forward the first discovery message.

[0129] For example, in the scenario shown in Figure 1, the first discovery message received by the second relay terminal R2 from the first relay terminal R1 has a first indication information indicating the first relay terminal. The first discovery message received by the second terminal UE2 from the third relay terminal R3 has a first indication information indicating the first, second, and third relay terminals. In the discovery response message, the first indication information indicates the relay terminals through which the first discovery information has passed. Since the first discovery information has passed through all relay terminals in the process of the first terminal discovering the second terminal via the first discovery message, the first indication information is not updated with the reception and forwarding of the discovery response message by different relay terminals. For example, in the scenario shown in Figure 1, the first discovery response message received by the first terminal UE1 from the first relay terminal R1 has a first indication information indicating the first, second, and third relay terminals.

[0130] For example, in the scenario shown in Figure 2, the first discovery message received by the second relay terminal R2 from the first relay terminal R1 has a first indication information indicating the first relay terminal. The first discovery message received by the second terminal UE2 from the third relay terminal R3 has a first indication information indicating the first relay terminal, the second relay terminal, the third relay terminal, and the second terminal. In the discovery response message, the first indication information indicates the relay terminals traversed by the first discovery information. Since the first discovery information has passed through all relay terminals along a certain path in the process of the first terminal discovering the second terminal, the first indication information is not updated with the reception and forwarding of the discovery response message by different relay terminals. For example, in the scenario shown in Figure 2, the first discovery response message received by the first terminal UE1 from the first relay terminal R1 has a first indication information indicating the first relay terminal, the second relay terminal, the third relay terminal, and the second terminal.

[0131] S102. The first terminal determines the first relay terminal based on the first information.

[0132] In this embodiment, the first terminal can determine the first relay terminal based on the first information described in step S101. The first relay terminal refers to a relay terminal that directly establishes a connection with the first terminal. The first relay terminal is one of multiple relay terminals, that is, one of the multiple relay terminals that sent the discovery response message to the first terminal as described in step S101. This application does not limit the process by which the first terminal determines the first relay terminal based on the first information. Optionally, the first relay terminal can be determined based on the first indication information in the first information. That is, the first relay terminal can be determined based on the relay terminals indicated by the first indication information in each discovery response message in the first information. In one example, the first relay terminal can be determined based on the number of relay terminals indicated by the first indication information in each discovery response message in the first information. For example, from the discovery response messages, the discovery response message with the smallest number of relay terminals indicated by the first indication information is selected, and the relay terminal that sent this discovery response message is determined as the first relay terminal.

[0133] In one example, the first terminal can identify a first relay terminal based on the first information; in another example, the first terminal can identify multiple first relay terminals based on the first information.

[0134] S103, The first terminal sends a connection message to the first relay terminal.

[0135] The connection message includes: a terminal identifier and second indication information; the second indication information is the first indication information in the discovery response message sent by the first relay terminal. The description of the terminal identifier and the discovery response message can be found in step S101, and will not be repeated here. In this embodiment, since the second indication information is the first indication information in the discovery response message sent by the first relay terminal, according to the description of the first indication information in the discovery response message in step S101, the second indication information is the identifier of the relay terminal corresponding to the first indication information in the discovery response message sent by the first relay terminal. For example, in the scenario shown in Figure 1, the second indication information includes: the identifier of the first relay terminal, the identifier of the second relay terminal, and the identifier of the third relay terminal. For example, in the scenario shown in Figure 2, the second indication information includes: the identifier of the first relay terminal, the identifier of the second relay terminal, the identifier of the third relay terminal, and the identifier of the second terminal.

[0136] In this embodiment, after the first terminal determines the first relay terminal based on the first information as described in step S101, the first terminal can send a connection message to the first relay terminal. This application does not limit the process by which the first terminal sends the connection message to the first relay terminal. In one example, the Layer 2 address of the first relay terminal can be determined based on its identifier, and then a connection message can be sent to the first relay terminal based on its Layer 2 address to establish a relay connection between the first terminal and the second terminal.

[0137] Optionally, the connection message type sent by the first terminal includes: Direct Communication Request (DCR message) and Link Modification Request (LMR). In one example, if it is determined that the first terminal and the first relay terminal are not connected through the Proximity Communications 5 (PC5) interface before sending the connection message, a DCR message is sent. In another example, if it is determined that the first terminal and the first relay terminal are already connected through the Proximity Communications 5 (PC5) interface before sending the connection message, an LMR message is sent to reuse the existing connection between the first terminal and the first relay terminal. Optionally, the LMR message also includes the Layer 2 address of the first relay terminal.

[0138] In this embodiment, the first terminal determines the first relay terminal by receiving first information, which includes discovery response messages sent by each of a plurality of relay terminals, and further sends a connection message to the first terminal to establish a relay connection between the first terminal and the second terminal. The discovery response messages in the first information include indications of the relay terminals through which the first discovery information has passed. Therefore, in determining the first relay terminal based on the first information, the discovery response message with the smallest number of relay terminals through which the first discovery information indicated by the first indication information has passed can be selected, and the relay terminal sending that discovery response message can be determined as the first relay terminal. This improves relay connection efficiency and further conserves wireless resources for relay communication.

[0139] Figure 4 is a signaling diagram of a relay connection establishment method provided in an embodiment of this application. As shown in Figure 4, the method includes:

[0140] S41, The first terminal broadcasts the first discovery message.

[0141] The first discovery message is used by the first terminal to discover the second terminal. The first discovery message includes: first discovery information, first hop count information, and first indication information; the first indication information indicates the relay terminals traversed by the first discovery information. In this embodiment, the description of the first discovery information and the first indication information can be referred to in step S101, and will not be repeated here. Since the first indication information included in the first discovery message is updated as different relay terminals receive and forward the first discovery message, the first indication information included in the first discovery message broadcast by the first terminal indicates that the first discovery information has not traversed any relay terminals.

[0142] The first hop count information limits the maximum number of hops required to transmit the first discovery information. In one example, the first hop count information is the Time To Live (TTL) value of the first discovery message. TTL limits the duration an IP packet can exist in a computer network. Specifically, although TTL literally translates to "live time," it actually represents the maximum number of hops an IP packet can be forwarded in a computer network. The TTL field is set by the sender of the IP packet. Along the entire forwarding path from source to destination, each router modifies this TTL value by decrementing it by 1 before forwarding the IP packet. If the TTL reaches 0 before the IP packet reaches its destination IP address, the router will discard the received IP packet with TTL=0 and send a "Sender's packet time exceeded" (ICMP time exceeded) message to the sender. Conversely, if the TTL value does not decrease to 0, the maximum number of hops required to transmit the first discovery information has not been reached. In one example, the first hop count information is the maximum hop count. The maximum hop count needs to be combined with the first indication information included in the first discovery message to limit the maximum number of hops for transmitting the first discovery information. For example, if the number of relay terminals indicated by the first indication information is less than the maximum hop count, then the number of hops for transmitting the first discovery information has not reached the maximum number of hops.

[0143] In this embodiment, the first terminal broadcasts a first discovery message, which is then received by multiple relay terminals. For example, in the scenario shown in Figure 1, the first terminal UE1 broadcasts a first discovery message, which is received by the first relay terminal and the second relay terminal, respectively.

[0144] S42. The relay terminal receives third information, wherein the third information includes a first discovery message broadcast by the first terminal or other relay terminals.

[0145] The first discovery message includes: first discovery information, first hop count information, and first indication information. The first hop count information limits the maximum number of hops for transmitting the first discovery information. The first indication information indicates the relay terminals through which the first discovery information passes. The descriptions of the first discovery information, first indication information, and first hop count information can be found in step S41 and will not be repeated here. Since the first indication information included in the first discovery message is updated as different relay terminals receive and forward the first discovery message, if the first discovery message is a message broadcast by the first terminal, the first indication information included in the first discovery message indicates that the first discovery information has not passed through any relay terminal. If the first discovery message is a message broadcast by another relay terminal, the first indication information included in the first discovery message indicates the relay terminals through which the first discovery information passes. The relay terminal broadcasting the first discovery message is included among the relay terminals through which the first discovery information indicated by the first indication information passes.

[0146] In this embodiment, the relay terminal can receive the first discovery message broadcast by the first terminal in step S41, and the relay terminal can also receive first discovery messages broadcast by other relay terminals. In one example, the third information received by the relay terminal includes: the first discovery message broadcast by the first terminal, and multiple first discovery messages broadcast by other relay terminals. In another example, the third information received by the relay terminal includes: multiple first discovery messages broadcast by other relay terminals.

[0147] S43. The relay terminal determines and broadcasts the first discovery message to be sent based on the third information.

[0148] In this embodiment, the relay terminal can determine the first discovery message to be sent based on the third information received in step S42, and broadcast the first discovery message to be sent. The third information includes the first discovery message broadcast by the first terminal or other relay terminals. The first discovery message includes: first discovery information, first hop count information, and first indication information; wherein the first hop count information is used to limit the maximum number of hops for transmitting the first discovery information; and the first indication information is used to indicate the relay terminals through which the first discovery information passes. The descriptions of the first discovery information, the first indication information, and the first hop count information can be referred to in step S41, and will not be repeated here.

[0149] In this application, the process by which the relay terminal determines and broadcasts the first discovery message to be sent based on the third information is not limited. Optionally, the first discovery message to be sent can be determined based on the first hop count information and / or the first indication information included in the third information.

[0150] In one example, the first discovery message to be sent can be determined based on the first indication information included in the third information. Specifically, the number of relay terminals indicated by the first indication information in each first discovery message can be determined based on the first indication information. Then, the first discovery message corresponding to the first indication information that minimizes the number of relay terminals indicated, or that the number of relay terminals is less than a preset threshold, can be determined as the first discovery message to be sent. Determining the first discovery message to be sent based on the number of relay terminals indicated by the first indication information can save wireless resources for relay connection establishment and relay communication.

[0151] In one example, the first discovery message to be sent can be determined based on the first indication information included in the third information. Specifically, based on the first indication information of each first discovery message, the first discovery message corresponding to the first indication information that does not include the current relay terminal among the indicated relay terminals can be determined as the first discovery message to be sent. Determining the first discovery message to be sent based on the number of relay terminals indicated by the first indication information can avoid loop phenomena and broadcast storms in the relay discovery process, improve the efficiency of relay connection establishment, and save radio resources for relay connection establishment.

[0152] In one example, the first discovery message to be sent can be determined based on the first hop count information included in the third information. Specifically, based on the description of the first hop count information in step S41, the first discovery message that has not reached the maximum hop count can be determined as the first discovery message to be sent.

[0153] In one example, the first discovery message to be sent can be determined based on the first hop count information and the first indication information included in the third information. Specifically, the first discovery messages that have not reached the maximum hop count can be filtered based on the first hop count information. At the same time, the first discovery messages corresponding to the first indication information that indicates the smallest number of relay terminals or that indicates the number of relay terminals that is less than a preset threshold can be filtered based on the first indication information. Furthermore, the first discovery messages corresponding to the first indication information that indicates that the relay terminals do not include the current relay terminal can be filtered based on the first indication information. The first discovery message that simultaneously meets the above three filtering conditions is determined as the first discovery message to be sent.

[0154] Optionally, the third information may also include the signal quality of the first discovery message. Therefore, determining and broadcasting the first discovery message to be sent based on the third information may include: determining and broadcasting the first discovery message to be sent based on one or more of the first hop count information, the signal quality of the first discovery message, and the first indication information.

[0155] In one example, the first discovery message to be sent can be determined based on the signal quality of the first discovery message and the first indication information included in the third information. After receiving the first discovery message broadcast by the first terminal or other relay terminal, the signal quality of the first discovery message can be obtained. Specifically, based on the signal quality of each first discovery message, first discovery messages with signal quality greater than a preset signal quality threshold can be filtered. At the same time, based on the first indication information, first discovery messages corresponding to the first indication information with the smallest number of indicated relay terminals or the number of relay terminals less than a preset number threshold can be filtered. Furthermore, based on the first indication information, first discovery messages corresponding to the first indication information that does not include the current relay terminal can be filtered. The first discovery message that simultaneously meets the above three filtering conditions is determined as the first discovery message to be sent.

[0156] In one example, the first discovery message to be sent can be determined based on the first hop count information, the first indication information, and the signal quality of the first discovery message included in the third information. Specifically, based on the first hop count information, first discovery messages that have not reached the maximum hop count can be filtered. Simultaneously, based on the first indication information, first discovery messages corresponding to the first indication information with the smallest number of indicated relay terminals, or the first indication information with the number of relay terminals less than a preset threshold, can be filtered. Furthermore, based on the signal quality of each first discovery message, first discovery messages with signal quality greater than a preset signal quality threshold can be filtered. Additionally, based on the first indication information, first discovery messages corresponding to the first indication information that does not include the current relay terminal can be filtered. The first discovery message that simultaneously meets the above four filtering conditions is determined as the first discovery message to be sent.

[0157] In this embodiment, after determining the first discovery message to be sent through one of the above processes, the determined first discovery message to be sent can be broadcast.

[0158] S44. The second terminal receives the fifth information, wherein the fifth information includes a first discovery message broadcast by each of the plurality of relay terminals.

[0159] The first discovery message includes: first discovery information, first hop count information, and first indication information; wherein the first hop count information is used to limit the maximum number of hops for transmitting the first discovery information; the first indication information is used to indicate the relay terminals through which the first discovery information passes; wherein the description of the first discovery information, the first indication information, and the first hop count information can be referred to the description in step S41, and will not be repeated in this step.

[0160] In this embodiment, in step S43, the relay terminal determines and broadcasts the first discovery message to be sent based on the third information. The fifth information received by the second terminal includes the first discovery message broadcast by each of the multiple relay terminals.

[0161] S45. The second terminal determines the first discovery message to be responded to based on the fifth information.

[0162] In this embodiment, the second terminal determines the first discovery message to be responded to based on the fifth information received in step S44. This application does not limit the process by which the second terminal determines the first discovery message to be responded to based on the fifth information; optionally, the first discovery message to be responded to can be determined based on the first hop count information and / or the first indication information.

[0163] In one example, the first discovery message to be responded to can be determined based on the first indication information included in the fifth information. Specifically, the number of relay terminals indicated by the first indication information in each first discovery message can be determined based on the first indication information. Then, the first discovery message corresponding to the first indication information that indicates the minimum number of relay terminals, or the first indication information that indicates a number of relay terminals less than a preset threshold, can be determined as the first discovery message to be responded to. Determining the first discovery message to be responded to based on the number of relay terminals indicated by the first indication information can save radio resources for relay connection establishment and relay communication, and improve the quality of relay services.

[0164] In one example, the first discovery message to be responded to can be determined based on the first hop count information included in the fifth information. Specifically, based on the description of the first hop count information in step S41, the first discovery message that has not reached the maximum hop count can be determined as the first discovery message to be responded to.

[0165] In one example, the first discovery message to be responded to can be determined based on the first hop count information and the first indication information included in the fifth information. Specifically, the first discovery message that has not reached the maximum hop count can be filtered based on the first hop count information. At the same time, the first discovery message corresponding to the first indication information that indicates the smallest number of relay terminals or the number of relay terminals is less than a preset threshold can be filtered based on the first indication information. The first discovery message that meets both of the above filtering conditions is determined as the first discovery message to be responded to.

[0166] Optionally, the fifth information also includes the signal quality of the first discovery message. Therefore, determining the first discovery message to be responded to based on the fifth information may include: determining the first discovery message to be responded to based on one or more of the first hop count information, the signal quality of the first discovery message, and preset sixth indication information, and the first indication information; the preset sixth indication information is used to indicate the relay terminal that the second terminal wishes to select.

[0167] In one example, the first discovery message to be responded to can be determined based on the preset sixth indication information and the first indication information included in the fifth information. Specifically, based on the first indication information, the first discovery message corresponding to the first indication information of the indicated relay terminals, including the relay terminals expected to be selected by the second terminal indicated by the preset sixth indication information, can be filtered. The second terminal may expect to select one or more relay terminals. Simultaneously, the first discovery message corresponding to the first indication information with the smallest number of indicated relay terminals, or with the number of relay terminals less than a preset threshold, can be filtered based on the first indication information. The first discovery message that simultaneously meets both filtering conditions is determined as the first discovery message to be responded to. Determining the first discovery message to be responded to based on the number of relay terminals indicated by the first indication information allows for targeted selection of relay terminals for relay connection based on the preset sixth indication information, improving the service quality of relay connection establishment.

[0168] In one example, the first discovery message to be responded to can be determined based on the signal quality of the first discovery message and the first indication information included in the fifth information. After receiving the first discovery message broadcast by the first terminal or other relay terminal, the signal quality of the first discovery message can be obtained. Specifically, the first discovery messages with signal quality greater than a preset signal quality threshold can be filtered based on the signal quality of each first discovery message. At the same time, the first discovery messages corresponding to the first indication information that indicates the smallest number of relay terminals or the first indication information that indicates the number of relay terminals that is less than a preset number threshold can be filtered based on the first indication information. The first discovery message that satisfies both of the above filtering conditions is determined as the first discovery message to be responded to.

[0169] In one example, the first discovery message to be responded to can be determined based on the first hop count information, the first indication information, the preset sixth indication information, and the signal quality of the first discovery message included in the fifth information. Specifically, based on the first hop count information, first discovery messages that have not reached the maximum hop count can be filtered. At the same time, based on the first indication information, first discovery messages corresponding to the first indication information with the smallest number of indicated relay terminals, or the number of relay terminals being less than a preset threshold, can be filtered. Based on the first indication information, first discovery messages corresponding to the first indication information of the indicated relay terminals, including the relay terminals expected to be selected by the second terminal indicated by the preset sixth indication information, can be filtered. Furthermore, based on the signal quality of each first discovery message, first discovery messages with signal quality greater than a preset signal quality threshold can be filtered. The first discovery message that simultaneously meets the above four filtering conditions is determined as the first discovery message to be responded to.

[0170] In one example, the first discovery message to be responded to can be determined based on the first indication information included in the fifth information, the preset sixth indication information, and the signal quality of the first discovery message. The specific process can be referred to the description in the example above, and will not be repeated here.

[0171] S46. The second terminal generates a discovery response message for the first discovery message to be responded to.

[0172] The discovery response message includes first indication information and first discovery information; the first indication information is used to indicate the relay terminal through which the first discovery information passes; the first discovery information includes: terminal identifier and relay service code;

[0173] In this embodiment, based on the description of the first indication information included in the discovery response message in step S101, the first indication information included in the discovery response message of the first discovery message to be responded to can be determined according to the first indication information included in the first discovery message to be responded to, and a discovery response message for each first discovery message to be responded to can be further generated.

[0174] S47. The second terminal sends the discovery response message to the corresponding relay terminal based on the Layer 2 address association.

[0175] Optionally, during the process of the first terminal sending a first discovery message to a relay terminal, or the relay terminal sending a message to another relay terminal, or the relay terminal sending a message to a second terminal, the terminal receiving the first discovery message will establish a Layer 2 address association between its own Layer 2 address and the Layer 2 address of the terminal sending the first discovery message, and store the established association in its own terminal. Here, the Layer 2 address of the terminal sending the first discovery message is the source Layer 2 address of the first discovery message, and the Layer 2 address of the receiving terminal is the destination Layer 2 address of the first discovery message. For example, after receiving the first discovery message from the relay terminal, the second terminal can establish a Layer 2 address association between the relay terminal and its own Layer 2 address, and store this association in its own terminal. Here, the Layer 2 address of the relay terminal is the source Layer 2 address of the first discovery message, and the Layer 2 address of the receiving terminal is the destination Layer 2 address of the first discovery message.

[0176] In this embodiment, after the second terminal generates the discovery response message of the first discovery message to be responded to, as described in step S46, the second terminal can determine the relay terminal to which the discovery response message will be sent based on the Layer 2 address association relationship, and then send the discovery response message to the corresponding relay terminal. In one example, the second terminal can determine the relay terminal to which the discovery response message will be sent based on the Layer 2 address association relationship described above. Specifically, it can obtain the Layer 2 address association relationship stored in the second terminal, then set the destination Layer 2 address of the first discovery message as the source Layer 2 address of the discovery response message, set the source Layer 2 address of the first discovery message as the destination Layer 2 address of the discovery response message, and finally send the discovery response message to the corresponding relay terminal based on the determined destination Layer 2 address of the discovery response message.

[0177] S48. The relay terminal receives a discovery response message sent by the second terminal or other relay terminals.

[0178] The discovery response message is a response message to the first discovery message; the discovery response message includes first indication information and first discovery information; the first indication information is used to indicate the relay terminal through which the first discovery information passes; the first discovery information includes: terminal identifier and relay service code; the first discovery message is used by the first terminal to discover the second terminal;

[0179] In one example, the relay terminal receives a discovery response message sent by the second terminal according to the Layer 2 address association as described in step S47.

[0180] In one example, a relay terminal receives a discovery response message sent by other relay terminals based on Layer 2 address association. Specifically, the other relay terminals are those that have received the discovery response message. Optionally, the other relay terminals can be those that have received the discovery response message sent by the second terminal based on Layer 2 address association, or they can be those that have received the discovery response message sent by other relay terminals based on Layer 2 address association. The process by which other relay terminals send the message to their corresponding relay terminals based on Layer 2 address association can be referenced from step S48, where the second terminal sends the discovery response message to its corresponding relay terminal based on Layer 2 address association; this step will not be repeated here.

[0181] S49. The relay terminal sends the discovery response message to the corresponding other relay terminals or the first terminal according to the layer 2 address association relationship.

[0182] In one example, if a relay terminal determines that a discovery response message will be sent to other relay terminals based on the Layer 2 address association, then it will send the discovery response message to the corresponding other relay terminals.

[0183] In one example, if the relay terminal determines that a discovery response message will be sent to the first terminal based on the Layer 2 address association, then the relay terminal will send the discovery response message to the first terminal.

[0184] S410, The first terminal receives first information, wherein the first information includes a discovery response message sent by each of the plurality of relay terminals.

[0185] The discovery response message is a response message to the first discovery message; the discovery response message includes first indication information and first discovery information; the first indication information is used to indicate the relay terminal through which the first discovery information passes; the first discovery information includes: terminal identifier and relay service code; the first discovery message is used by the first terminal to discover the second terminal;

[0186] The description of this step can be found in step S101, and will not be repeated here.

[0187] S411. The first terminal determines the first relay terminal based on the first information.

[0188] The first relay terminal is one of multiple relay terminals.

[0189] In this application, the process by which the first terminal determines the first relay terminal based on the first information is not limited. Optionally, determining the first relay terminal based on the first information may include: determining the first relay terminal based on the first indication information in the first information.

[0190] In one example, a first relay terminal can be determined based on the first indication information included in the first information. Specifically, the number of relay terminals indicated by the first indication information in each discovery response message can be determined based on the first indication information. Then, the discovery response message corresponding to the first indication information with the smallest number of indicated relay terminals, or whose number of relay terminals is less than a preset threshold, is selected as the filtering condition for the first relay terminal. Specifically, relay terminals that send discovery response messages that meet this filtering condition can be determined as the first relay terminal. Determining the first relay terminal based on the number of relay terminals indicated by the first indication information can save wireless resources for relay connection establishment and relay communication, and improve the quality of relay services.

[0191] Optionally, the discovery response message may also include a time-to-live value; and / or, the first information may also include the signal quality of the discovery response message; wherein the time-to-live value is the numerical value of the time-to-live of the first discovery message corresponding to the discovery response message when it is responded to.

[0192] In the process of determining the first relay terminal based on the time-to-live value included in the discovery response message, the discovery response message with the smallest time-to-live value can be selected as the screening condition for determining the first relay terminal.

[0193] In the process of determining the first relay terminal based on the signal quality of the discovery response message, discovery response messages with signal quality greater than a preset signal quality threshold can be selected as the screening condition for determining the first relay terminal.

[0194] Optionally, determining the first relay terminal based on the first information may include: determining the first relay terminal based on one or more of the following: the time-to-live value in the first information, the signal quality of the discovery response message, and preset third indication information, and the first indication information; wherein the preset third indication information is used to indicate the relay terminal that the first terminal wishes to select.

[0195] In one example, the first relay terminal can be determined based on the lifetime value in the first information, the preset third indication information, the signal quality of the discovery response message, and the first indication information. Specifically, based on the lifetime value in the first information, the discovery response message with the smallest lifetime value can be filtered. Simultaneously, based on the signal quality of the discovery response message, discovery response messages with signal quality greater than a preset signal quality threshold can be filtered. Furthermore, based on the first indication information in the first information, the number of relay terminals indicated by the first indication information in the discovery response message can be determined. Then, the discovery response messages corresponding to the first indication information with the smallest number of indicated relay terminals, or whose number of relay terminals is less than a preset number threshold, can be filtered. Additionally, based on the first indication information in the first information, the discovery response messages corresponding to the first indication information of the indicated relay terminals, including those of the relay terminals expected to be selected by the first terminal indicated by the preset third indication information, can be filtered. The relay terminal that sends a discovery response message that simultaneously satisfies the above four filtering conditions is determined as the first relay terminal.

[0196] In one example, the first relay terminal can be determined based on the time-to-live (TTL) value in the first information and the first indication information. The specific process can be referred to the description in the example above, and will not be repeated here. In another example, the first relay terminal can be determined based on the signal quality of the discovery response message and the first indication information. The specific process can be referred to the description in the example above, and will not be repeated here. In another example, the first relay terminal can be determined based on preset third indication information and the first indication information. The specific process can be referred to the description in the example above, and will not be repeated here. In another example, the first relay terminal can be determined based on the time-to-live (TTL) value in the first information, the signal quality of the discovery response message, and the first indication information. The specific process can be referred to the description in the example above, and will not be repeated here. In another example, the first relay terminal can be determined based on the signal quality of the discovery response message, the preset third indication information, and the first indication information. The specific process can be referred to the description in the example above, and will not be repeated here. In another example, the first relay terminal can be determined based on the time-to-live (TTL) value in the first information, the preset third indication information, and the first indication information. The specific process can be found in the description in the example above, and will not be repeated here.

[0197] In this embodiment, the terminal identifier includes: a first terminal identifier and a second terminal identifier, or the terminal identifier includes: a first terminal identifier. Specifically, in U2U communication, the terminal identifier includes: a first terminal identifier and a second terminal identifier; in U2N communication, the terminal identifier includes: a first terminal identifier.

[0198] In this embodiment, in step S43, during the process of the relay terminal determining and broadcasting the first discovery message to be sent based on the third information, determining the first discovery message to be sent based on the number of relay terminals indicated by the first indication information can save wireless resources for relay connection establishment and relay communication, and improve the quality of relay service; in step S45, during the process of the second terminal determining the first discovery message to be responded to based on the fifth information, determining the first discovery message to be responded to based on the number of relay terminals indicated by the first indication information can save wireless resources for relay connection establishment and relay communication; in step S411, during the process of the first terminal determining the first relay terminal based on the first information, determining the first relay terminal based on the number of relay terminals indicated by the first indication information can save wireless resources for relay connection establishment and relay communication, and improve the quality of relay service.

[0199] Figure 5 is a signaling diagram of another relay connection establishment method provided in an embodiment of this application. As shown in Figure 5, the method includes:

[0200] S51, The first terminal sends a connection message to the first relay terminal.

[0201] The connection message includes: a terminal identifier and second indication information; the second indication information is the first indication information in the discovery response message sent by the first relay terminal. For example, in the scenario shown in Figure 1, the second indication information is: the identifier of the first relay terminal, the identifier of the second relay terminal, and the identifier of the third relay terminal. For example, in the scenario shown in Figure 2, the second indication information is: the identifier of the first relay terminal, the identifier of the second relay terminal, the identifier of the third relay terminal, and the identifier of the second terminal.

[0202] In this embodiment, after the first terminal determines the first relay terminal based on the first information as described in step S411, the first terminal sends a connection message to the first relay terminal. This application does not limit the process of the first terminal sending the connection message to the first relay terminal. Optionally, the identifier of the first relay terminal can be determined based on the second indication information included in the connection message. Then, the layer 2 address of the first relay terminal can be determined based on the association between the identifier and the layer 2 address of the first relay terminal. Finally, the connection message is sent to the first relay terminal based on the layer 2 address of the first terminal.

[0203] S52. The relay terminal receives a connection message sent by the first terminal or other relay terminals. The connection message includes: terminal identifier and second indication information.

[0204] Wherein, the second indication information is the first indication information in the discovery response message sent by the first relay terminal; the first relay terminal is the relay terminal determined according to the first information, and the first information is the information received by the first terminal including the discovery response message sent by each of the multiple relay terminals;

[0205] In one example, for the scenario shown in Figure 1, the second indication information is: the identifier of the first relay terminal, the identifier of the second relay terminal, and the identifier of the third relay terminal. Alternatively, for the scenario shown in Figure 2, the second indication information is: the identifier of the first relay terminal, the identifier of the second relay terminal, the identifier of the third relay terminal, and the identifier of the second terminal.

[0206] S52a: The first relay terminal receives the connection message sent by the first terminal. The process of the first terminal sending the connection message to the first relay terminal can be referred to the description in step S51, and will not be repeated here.

[0207] S52b: The second relay terminal receives the connection message sent by the first relay terminal.

[0208] S52c: The third relay terminal receives the connection message sent by the second relay terminal.

[0209] S53. The relay terminal determines, based on the second instruction information, that the connection message will be sent to other relay terminals or the second terminal, and sends the connection message to them.

[0210] In this embodiment, the relay terminal determines the identifier of the relay terminal receiving the connection message based on the identifier of the relay terminal that sent the connection message and the second indication information. Furthermore, the relay terminal can send the connection message to the relay terminal that received the connection message based on the identifier of the relay terminal that received the connection message.

[0211] In one example, for the scenario shown in Figure 1, the second indication information is: the identifier of the first relay terminal, the identifier of the second relay terminal, and the identifier of the third relay terminal. Alternatively, for the scenario shown in Figure 2, the second indication information is: the identifier of the first relay terminal, the identifier of the second relay terminal, the identifier of the third relay terminal, and the identifier of the second terminal.

[0212] In this application, the process by which the relay terminal determines, based on the second instruction information, that the connection message will be sent to other relay terminals or the second terminal, and sends the connection message to them, is not limited.

[0213] Optionally, determining, based on the second indication information, to send the connection message to other relays or a second terminal, and sending the connection message to them, may include:

[0214] According to the second indication information, if it is determined that the connection message will be sent to another relay terminal, then the connection message is unicast to that relay terminal. Specifically, the relay terminal determines the identifier of the receiving relay terminal based on the identifier of the relay terminal that sent the connection message and the second indication information. If the identifier of the receiving relay terminal corresponds to another relay terminal, then the Layer 2 address of the receiving relay terminal can be determined based on the identifier of the receiving relay terminal, and further, the connection address is unicast to the receiving relay terminal based on the Layer 2 address of the receiving relay terminal. For example, in the scenario shown in Figure 1, or in the scenario shown in Figure 2, the other relay terminals include one of the first relay terminal, the second relay terminal, and the third relay terminal.

[0215] According to the second instruction information, if it is determined that a connection message will be sent to the second terminal, then the connection message is sent to the second terminal device according to its type. Specifically, the relay terminal determines the identifier of the receiving relay terminal based on the identifier of the relay terminal that sent the connection message and the second instruction information. If the identifier of the receiving relay terminal corresponds to the second terminal, then the connection message can be sent to the second terminal device according to its type. The types of the second terminal devices include relay devices and terminal devices. For example, in the scenario shown in Figure 1, the type of the second terminal device is a terminal device; in the scenario shown in Figure 2, the type of the second terminal device is a relay device. This application does not limit the process of sending a connection message to the second terminal device according to its type. Optionally, sending a connection message to the second terminal device according to its type may include:

[0216] If the second terminal device is a relay device, a connection message is unicast to it. Specifically, if the second terminal device is a relay device, its Layer 2 address can be determined based on the association between its identifier and Layer 2 address. Furthermore, a connection message can be unicast to the second terminal based on its Layer 2 address. If the second terminal device is a terminal device, a connection message is broadcast. Specifically, if the second terminal device is a terminal device, and the association between its identifier and Layer 2 address cannot be obtained, a connection message can be broadcast so that the second terminal receives the connection message broadcast by the relay device.

[0217] S53a: The first relay terminal determines, based on the second indication information, that a connection message will be sent to the second relay terminal, and sends the connection message to it. Specifically, the first relay terminal determines, based on its own identifier and the second indication information, that the identifier of the relay terminal receiving the connection message is the identifier of the second relay terminal. Further, based on the association between the identifier of the second relay terminal and the layer 2 address of the second relay terminal, the first relay terminal determines the layer 2 address of the second relay terminal, and then sends the connection message to the second relay terminal based on the layer 2 address of the second relay terminal.

[0218] For example:

[0219] S53b: The second relay terminal determines, based on the second indication information, that the connection message will be sent to the third relay terminal, and sends the connection message to it. Specifically, the second relay terminal determines, based on its own identifier and the second indication information, that the identifier of the relay terminal receiving the connection message is the identifier of the third relay terminal. Further, based on the association between the identifier of the third relay terminal and its Layer 2 address, it determines the Layer 2 address of the third relay terminal, and then sends the connection message to the third relay terminal based on the Layer 2 address.

[0220] S53c: The third relay terminal determines, based on the second indication information, that a connection message will be sent to the second terminal, and sends the connection message to it. Specifically, in the scenario shown in Figure 1, the third relay terminal determines, based on its identifier and the second indication information, that it is the last relay terminal, and the connection message will be sent to the second terminal. At this time, the association between the second terminal's identifier and its Layer 2 address cannot be obtained. Optionally, the third terminal can broadcast the connection message so that the second terminal can receive the connection message broadcast by the third relay terminal. In the scenario shown in Figure 2, the third relay terminal determines, based on its identifier and the second indication information, that the identifier of the relay terminal receiving the connection message is the identifier of the second terminal. Further, based on the association between the second terminal's identifier and its Layer 2 address, it determines the Layer 2 address of the second terminal, and then sends the connection message to the second terminal based on the Layer 2 address of the second terminal.

[0221] S54. The second terminal receives a connection message sent by the relay terminal. The connection message includes: terminal identifier and second indication information.

[0222] Wherein, the second indication information is the first indication information in the discovery response message sent by the first relay terminal; the first relay terminal is the relay terminal determined according to the first information, and the first information is the information received by the first terminal including the discovery response message sent by each of the multiple relay terminals;

[0223] In this embodiment, the relay terminal determines, based on the second indication information, that the connection message will be sent to other relay terminals or the second terminal, and sends the connection message to them. The second terminal then receives the connection message sent by the relay terminal. Specifically, in the scenario shown in Figure 1, the second terminal receives the connection message sent by the relay terminal based on its Layer 2 address. In the scenario shown in Figure 2, the second terminal receives the connection message broadcast by the relay terminal.

[0224] For example:

[0225] S54a: The second terminal receives a connection message sent by the third relay terminal. The connection message includes: a terminal identifier and second indication information. Specifically, in the scenario shown in Figure 1, the second terminal receives a connection message sent by the third relay terminal based on the second terminal's Layer 2 address. In the scenario shown in Figure 2, the second terminal receives a connection message broadcast by the third relay terminal.

[0226] S55. The second terminal generates a connection response message corresponding to the connection message based on the terminal identifier and the second indication information included in the connection message, and determines the relay terminal corresponding to the connection response message.

[0227] Optionally, the connection response message includes a terminal identifier, an identifier of the second terminal or relay terminal that sent the connection response message, and an identifier of the relay terminal or the first terminal that received the connection response message.

[0228] In this embodiment, the second terminal can generate a connection response message corresponding to the connection message based on the terminal identifier and the second indication information included in the connection message. The connection response message generated by the second terminal includes: a terminal identifier, an identifier of the second terminal, and an identifier of the relay terminal receiving the connection response message. The relay terminal corresponding to the identifier of the relay terminal receiving the connection response message is determined to be the relay terminal corresponding to the connection response message.

[0229] For example:

[0230] S55a: The second terminal generates a connection response message corresponding to the connection message based on the terminal identifier and the second indication information included in the connection message, and determines the third relay terminal corresponding to the connection response message. The connection response message generated by the second terminal includes: a terminal identifier, the identifier of the second terminal, and the identifier of the third relay terminal.

[0231] S56. The second terminal sends the connection response message to the relay terminal corresponding to the connection response message.

[0232] In this embodiment, after the second terminal generates a connection response message corresponding to the connection message based on the terminal identifier and the second indication information included in the connection message, and determines the relay terminal corresponding to the connection response message, the second terminal can send the connection response message to the relay terminal corresponding to the connection response message. This application does not limit the process by which the second terminal sends the connection response message to the relay terminal corresponding to the connection response message. Optionally, the layer 2 address of the relay terminal corresponding to the connection response message can be determined based on the association between the identifier of the relay terminal receiving the connection response message and the layer 2 address of the relay terminal corresponding to the connection response message. Further, the second terminal can send the connection response message to the relay terminal corresponding to the connection response message based on the layer 2 address of the relay terminal corresponding to the connection response message.

[0233] For example:

[0234] S56a. The second terminal sends the connection response message to the third relay terminal corresponding to the connection response message. Specifically, the second terminal can determine the layer 2 address of the third relay terminal corresponding to the connection response message based on the identifier of the relay terminal corresponding to the connection response message (i.e., the third relay terminal) and the association relationship between the layer 2 address of the third relay terminal. Further, the second terminal can send the connection response message to the third relay terminal based on the layer 2 address of the third relay terminal.

[0235] S57. The relay terminal receives a connection response message sent by the second terminal or other relay terminals.

[0236] The connection response message is a response message to the connection message; the connection response message includes: the terminal identifier and the identifier of the relay terminal that sent the connection response message.

[0237] In this embodiment, the process by which a relay terminal receives a connection response message sent by a second terminal or another relay terminal can refer to the process described in step S56 whereby the second terminal sends a connection response message to the relay terminal corresponding to the connection response message. Optionally, the relay terminal can receive a connection response message sent by a second terminal or another relay terminal through its Layer 2 address. In one example, if the connection response message received by the relay terminal includes the identifier of the second terminal that sent the connection response message, then the connection response message received by the relay terminal is the connection response message sent by the second terminal.

[0238] In one example, if the connection response message received by the relay terminal includes the identifier of another relay terminal that sent the connection response message, then the connection response message received by the relay terminal is a connection response message sent by the other relay terminal. In this embodiment, the connection response message sent by the other relay terminal is a connection response message regenerated based on the connection response message sent by the second terminal. This application does not limit the process of regenerating the connection response message. Optionally, the connection message corresponding to the connection response message received by the relay terminal can be determined based on the terminal identifier, the identifier of the second terminal that sent the connection response message, and the identifier of the relay terminal that received the connection response message, all included in the connection response message sent by the second terminal. Furthermore, the identifier of the first terminal or relay terminal that received the connection response message can be determined based on the second indication information included in the connection response message, and the connection response message can be further regenerated.

[0239] For example:

[0240] S57a, the third relay terminal receives a connection response message sent by the second terminal. The connection response message sent by the second terminal includes: a terminal identifier, an identifier of the second terminal, and an identifier of the third relay terminal. In one example, the third relay terminal regenerates a connection response message based on the connection response message sent by the second terminal and the corresponding connection message. Optionally, the third relay terminal determines the identifier of the second relay terminal receiving the connection response message, which is included in the connection response message generated by the third relay terminal, based on the connection response message sent by the second terminal and the corresponding connection message, and further determines the connection response message generated by the third relay terminal.

[0241] S57b, the second relay terminal receives a connection response message sent by the third relay terminal. The connection response message sent by the third relay terminal includes: a terminal identifier, an identifier of the third relay terminal, and an identifier of the second relay terminal. In one example, the second relay terminal regenerates a connection response message based on the connection response message sent by the third relay terminal and the corresponding connection message. Optionally, the second relay terminal determines the identifier of the first relay terminal receiving the connection response message included in the connection response message generated by the second relay terminal, based on the connection response message sent by the third terminal and the corresponding connection message, and further determines the connection response message generated by the second relay terminal.

[0242] S57c, the first relay terminal receives a connection response message sent by the second relay terminal. The connection response message sent by the second relay terminal includes: a terminal identifier, an identifier of the second terminal, and an identifier of the first relay terminal. In one example, the first relay terminal regenerates a connection response message based on the connection response message sent by the second relay terminal and the corresponding connection message. Optionally, the first relay terminal determines the identifier of the first terminal receiving the connection response message included in the connection response message generated by the first relay terminal, based on the connection response message sent by the second terminal and the corresponding connection message, and further determines the connection response message generated by the first relay terminal.

[0243] S58. The relay terminal sends the connection response message to the first terminal or other relay terminals according to the terminal identifier and the identifier of the relay terminal receiving the connection response message included in the connection response message.

[0244] In this embodiment, the relay terminal sends the regenerated connection response message to the first terminal or other relay terminals based on the terminal identifier and the identifier of the relay terminal that sent the connection response message, which are included in the connection response message. This process can refer to the process described in step S56 where the second terminal sends the connection response message to the relay terminal corresponding to the connection response message. Optionally, the relay terminal can determine the Layer 2 address of the relay terminal receiving the connection response message based on its identifier. Further, it can send the regenerated connection response message to the first terminal or other relay terminals based on the Layer 2 address of the relay terminal receiving the connection response message.

[0245] For example:

[0246] S58a. The third relay terminal sends the connection response message to the second relay terminal based on the terminal identifier included in the connection response message and the identifier of the relay terminal receiving the connection response message. As described in step S57b, the connection response message sent by the third relay terminal includes: a terminal identifier, the identifier of the third relay terminal, and the identifier of the second relay terminal. Optionally, the third relay terminal sends the connection response message to the second relay terminal based on the terminal identifier included in the connection response message and the identifier of the second relay terminal receiving the connection response message. Specifically, the third relay terminal can determine the Layer 2 address of the second relay terminal based on the identifier of the second relay terminal receiving the connection response message, and further, can send the regenerated connection response message of the third relay terminal to the second relay terminal based on the Layer 2 address of the second relay terminal.

[0247] S58b: The second relay terminal sends the connection response message to the first relay terminal based on the terminal identifier included in the connection response message and the identifier of the relay terminal receiving the connection response message. As described in step S57c, the connection response message sent by the second relay terminal includes: a terminal identifier, the identifier of the second relay terminal, and the identifier of the first relay terminal. Optionally, the second relay terminal sends the connection response message to the first relay terminal based on the terminal identifier included in the connection response message and the identifier of the first relay terminal receiving the connection response message. Specifically, the second relay terminal can determine the Layer 2 address of the first relay terminal based on the identifier of the first relay terminal receiving the connection response message, and further, can send the regenerated connection response message of the second relay terminal to the first relay terminal based on the Layer 2 address of the first relay terminal.

[0248] S58c: The first relay terminal sends a connection response message to itself based on the terminal identifier included in the connection response message and the identifier of the relay terminal receiving the connection response message. As described in step S57, the connection response message sent by the first relay terminal includes: a terminal identifier, the identifier of the first terminal, and the identifier of the first terminal. Optionally, the first relay terminal sends the connection response message to itself based on the terminal identifier included in the connection response message and the identifier of the first terminal receiving the connection response message. Specifically, the first relay terminal can determine the Layer 2 address of the first terminal based on the identifier of the first terminal receiving the connection response message, and further, can send a newly generated connection response message to itself based on the Layer 2 address of the first terminal.

[0249] S59. The first terminal receives the connection response message sent by the first relay terminal.

[0250] The connection response message is a response message to the connection message. In this embodiment, the process of the first terminal receiving the connection response message sent by the first relay terminal can refer to the process described in step S58 whereby the relay terminal sends the connection response message to the first terminal or other relay terminals based on the terminal identifier included in the connection response message and the identifier of the relay terminal receiving the connection response message. Optionally, the first terminal receives the connection response message sent by the first intermediate terminal based on the layer 2 address of the first terminal.

[0251] In this embodiment, the connection message includes: a terminal identifier and second indication information; the second indication information is the first indication information in the discovery response message sent by the first relay terminal. During the process of the first terminal sending a connection message to the first relay terminal and the relay terminal sending a connection message to other relay terminals or second terminals, the relay terminal or second terminal to be sent to is determined according to the second indication information in the connection message, which improves the accuracy of relay connection, saves the signaling overhead of the connection establishment process, and further improves the quality of relay communication.

[0252] Figure 6 is a signaling diagram of another relay connection establishment method provided in an embodiment of this application. As shown in Figure 6, the method includes:

[0253] S61. The relay terminal generates and broadcasts a second discovery message.

[0254] The second discovery message is used by the first terminal to discover the second terminal. The second discovery message includes: fourth indication information and second discovery information. The fourth indication information indicates the relay terminals traversed by the second discovery information. The second discovery information includes: a terminal identifier and a relay service code. The description of the terminal identifier and relay service code can be found in step S101, and will not be repeated in this embodiment. The second discovery information originates from the second terminal; therefore, the relay terminals traversed by the second discovery information indicated by the fourth indication information are all the relay terminals traversed by the first terminal in discovering the second terminal.

[0255] In this embodiment, the second discovery message is a discovery message generated by the relay terminal to enable the first terminal to discover the second terminal. The relay terminal generating the second discovery message is one that has already discovered the second terminal through other relay discovery or relay connection establishment processes. Optionally, the relay terminal can obtain second discovery information from the already discovered second terminal, and determine fourth indication information based on the relay terminals traversed from the second terminal to the relay terminal according to the second discovery information, further generating the second discovery message.

[0256] In this embodiment, after the relay terminal generates the second discovery message, it can broadcast the generated second discovery message to enable the first terminal to discover the second terminal. The second discovery information included in the second discovery message does not change with the broadcast of the second discovery message, but the fourth indication information included in the second discovery message is updated with the broadcast of the second discovery message. That is, the fourth indication information is used to indicate the relay terminals traversed by the second terminal on its way to the relay terminal that generated the second discovery message, and the relay terminals traversed during the broadcast process.

[0257] S62. The relay terminal receives fourth information; wherein the fourth information includes a second discovery message broadcast by each of the multiple other relay terminals.

[0258] In this embodiment, other relay terminals include the relay terminal that generated the second discovery message and / or other relay terminals that broadcast the second discovery message. The fourth information includes second discovery messages broadcast by different relay terminals, which contain the same second discovery information but different fourth indication information. For example, if the second discovery message is a discovery message broadcast by the relay terminal that generated the second discovery message, the fourth indication information indicates the relay terminals the second terminal passes through to reach the relay terminal that generated the second discovery message. If the second discovery message is a discovery message broadcast by another relay terminal that broadcasts the second discovery message, the fourth indication information indicates the relay terminals the second terminal passes through to reach the relay terminal that generated the second discovery message, and the relay terminals passed through during the broadcast process.

[0259] S63. The relay terminal determines and broadcasts the second discovery message to be sent based on the fourth information.

[0260] In this embodiment, after receiving the fourth information, the relay terminal can determine and broadcast the second discovery message to be sent based on the fourth information. This application does not limit the process of determining and broadcasting the second discovery message based on the fourth information.

[0261] Optionally, determining and broadcasting the second discovery message to be sent based on the fourth information may include: determining and broadcasting the second discovery message to be sent based on the fourth instruction information.

[0262] In one example, the second discovery message to be sent can be determined based on the fourth indication information included in the fourth information. Specifically, the number of relay terminals indicated by the fourth indication information in each second discovery message can be determined based on the fourth indication information. Then, the second discovery message corresponding to the fourth indication information with the minimum number of indicated relay terminals, or the number of relay terminals being less than a preset threshold, can be determined as the second discovery message to be sent. Determining the second discovery message to be sent based on the number of relay terminals indicated by the fourth indication information can save wireless resources for relay connection establishment and relay communication.

[0263] In one example, the second discovery message to be sent can be determined based on the fourth indication information included in the fourth information. Specifically, based on the fourth indication information of each second discovery message, the second discovery message corresponding to the fourth indication information that does not include the current relay terminal among the indicated relay terminals can be determined as the second discovery message to be sent. Determining the first discovery message to be sent based on the number of relay terminals indicated by the fourth indication information can avoid loop phenomena and broadcast storms in the relay discovery process, improve the efficiency of relay connection establishment, and save radio resources for relay connection establishment.

[0264] In one example, the second discovery message to be sent can be determined based on the fourth indication information included in the fourth information. Specifically, the historical fourth indication information of the current relay terminal can be obtained first. This historical fourth indication information indicates the relay terminals that discovered the second terminal during historical relay discovery or relay connection establishment. The second discovery message corresponding to the fourth indication information where the number of relay terminals indicated by the fourth indication information is less than the number of relay terminals indicated by the historical fourth indication information is determined as the second discovery message to be sent. Determining the first discovery message to be sent based on the number of relay terminals indicated by the fourth indication information can save radio resources for relay connection establishment and relay communication.

[0265] Optionally, the relay terminal may determine one or more of the methods for sending the second discovery message based on the fourth indication information included in the fourth information, as shown in the example above, and determine and broadcast the second discovery message to be sent.

[0266] Optionally, the second discovery message may also include second hop count information; and / or the fourth information may also include the signal quality of the second discovery message; the second hop count information is used to limit the maximum number of hops for transmitting the second discovery information; in one example, the second hop count information is a value of the time-to-live (TTL) of the second discovery message, wherein the description of the TTL can be referred to the description in step S41, and will not be repeated in this step. Specifically, if the TTL value has not decreased to 0, the number of hops for transmitting the second discovery information has not reached the maximum number of hops. In one example, the second hop count information is a maximum hop value, wherein the maximum hop value needs to be combined with the fourth indication information included in the second discovery message to limit the maximum number of hops for transmitting the second discovery information. For example, if the number of relay terminals indicated by the fourth indication information is less than the maximum hop value, the number of hops for transmitting the second discovery information has not reached the maximum number of hops.

[0267] Optionally, the second discovery message to be sent is determined and broadcast according to the fourth information, including: determining and broadcasting the second discovery message to be sent according to one or more of the second hop count information and the signal quality of the second discovery message in the fourth information, and the fourth indication information.

[0268] In one example, the second discovery message to be sent can be determined based on the fourth indication information and the second hop count information included in the fourth information. Specifically, one or more of the methods shown in the example above for determining the second discovery message to be sent based on the fourth indication information included in the fourth information can be used to determine and broadcast the second discovery message to be sent. At the same time, the second discovery messages that have not reached the maximum hop count can be filtered based on the second hop count information, and the second discovery messages that meet both of the above filtering conditions can be determined as the second discovery messages to be sent.

[0269] In one example, the second discovery message to be sent can be determined based on the fourth indication information included in the fourth information and the signal quality of the second discovery message. After receiving the second discovery message broadcast by other relay terminals, the signal quality of the second discovery message can be obtained. Specifically, based on the signal quality of each second discovery message, second discovery messages with signal quality greater than a preset signal quality threshold can be filtered. At the same time, one or more of the methods for determining the second discovery message to be sent based on the fourth indication information included in the fourth information, as shown in the example above, can be used to determine and broadcast the second discovery message to be sent. The second discovery message that simultaneously meets the above two filtering conditions is determined as the second discovery message to be sent.

[0270] In one example, the second discovery message to be sent can be determined based on the fourth indication information included in the fourth information, the second hop count information, and the signal quality of the second discovery message. Specifically, one or more of the methods shown in the example above for determining the second discovery message to be sent based on the fourth indication information included in the fourth information can be used to determine and broadcast the second discovery message to be sent. At the same time, the second discovery messages that have not reached the maximum hop count can be filtered based on the second hop count information. The second discovery messages that simultaneously meet the above three filtering conditions are determined as the second discovery messages to be sent.

[0271] S64. The first terminal receives the second information; wherein the second information includes a second discovery message broadcast by each of the plurality of relay terminals.

[0272] Wherein, the second discovery message is used by the first terminal to discover the second terminal; the second discovery message comes from the relay terminal, and the second discovery message includes: fourth indication information and second discovery information; the fourth indication information is used to indicate the relay terminal through which the second discovery information passes; the second discovery information includes: terminal identifier and relay service code; the second discovery information comes from the second terminal;

[0273] In this embodiment, the multiple relay terminals include the relay terminal that generates the second discovery message and / or the relay terminal that broadcasts the second discovery message. The second information includes second discovery messages broadcast by different relay terminals, which contain the same second discovery information but different fourth indication information. For example, if the second discovery message is a discovery message broadcast by the relay terminal that generates the second discovery message, the fourth indication information indicates the relay terminals traversed by the second terminal to reach the relay terminal that generated the second discovery message; if the second discovery message is a discovery message broadcast by the relay terminal that broadcasts the second discovery message, the fourth indication information indicates the relay terminals traversed by the second terminal to reach the relay terminal that generated the second discovery message, and the relay terminals traversed during the broadcast process.

[0274] S65. The first terminal determines the first relay terminal based on the second information. The first relay terminal is one of a plurality of relay terminals.

[0275] In this embodiment, after receiving the second information, the first relay terminal can be determined based on the second information. This application does not limit the process of determining the first relay terminal based on the second information; optionally, determining the first relay terminal based on the second information may include: determining the first relay terminal based on the fourth indication information in the second information.

[0276] In one example, the first relay terminal can be determined based on the fourth indication information included in the second information. Specifically, the number of relay terminals indicated by the fourth indication information in each second discovery message can be determined based on the fourth indication information. Then, the second discovery message corresponding to the fourth indication information with the smallest number of indicated relay terminals, or whose number of relay terminals is less than a preset threshold, is selected as the filtering condition for the first relay terminal. Specifically, the relay terminal that sends a second discovery message that meets this filtering condition can be determined as the first relay terminal. Determining the first relay terminal based on the number of relay terminals indicated by the fourth indication information can save wireless resources for relay connection establishment and relay communication.

[0277] Optionally, the second discovery message may further include second hop count information; and / or the second information may also include the signal quality of the second discovery message; the second hop count information is used to limit the maximum number of hops for transmitting the second discovery information. The description of the second hop count information can be found in step S63, and will not be repeated here.

[0278] Optionally, determining the first relay terminal based on the second information includes: determining the first relay terminal based on one or more of the second hop count information, the signal quality of the second discovery message, and the preset third indication information, and the fourth indication information; the preset third indication information is used to indicate the relay terminal that the first terminal wishes to select.

[0279] In one example, the first terminal can be determined based on the second hop count information, the fourth indication information, the signal quality of the second discovery message, and the preset third indication information in the second information. Specifically, based on the second hop count information, second discovery messages that have not reached the maximum hop count can be filtered. Simultaneously, based on one or more methods shown in the example above for determining the second discovery message to be sent according to the fourth indication information included in the fourth information, the second discovery message to be sent can be determined and broadcast. After receiving second discovery messages broadcast by other relay terminals, the signal quality of the second discovery messages can be obtained. Specifically, based on the signal quality of each second discovery message, second discovery messages with signal quality greater than a preset signal quality threshold can be filtered. Simultaneously, based on the fourth indication information in the second information, the discovery response messages corresponding to the fourth indication information of the relay terminals indicated, including those desired by the first terminal indicated by the preset third indication information, can be filtered. The relay terminal that sends a discovery response message that simultaneously meets the above four filtering conditions is determined as the first relay terminal.

[0280] In one example, the first terminal can be determined based on the fourth indication information in the second information, the signal quality of the second discovery message, and the preset third indication information. The specific process can be referred to the description in the example above, and will not be repeated here.

[0281] In this embodiment, the terminal identifier includes: a first terminal identifier and a second terminal identifier, or the terminal identifier includes: a first terminal identifier. Specifically, in U2U communication, the terminal identifier includes: a first terminal identifier and a second terminal identifier; in U2N communication, the terminal identifier includes: a first terminal identifier.

[0282] In this embodiment, in step S63, the relay terminal determines and broadcasts a second discovery message to be sent based on the fourth information. Determining the second discovery message based on the number of relay terminals indicated by the fourth information saves wireless resources for relay connection establishment and relay communication. Determining the first discovery message based on the number of relay terminals indicated by the fourth information also avoids loop phenomena and broadcast storms during the relay discovery process, improving the efficiency of relay connection establishment and saving wireless resources. In step S65, the first terminal determines a first relay terminal based on the second information. The first relay terminal is one of multiple relay terminals. Determining the first relay terminal based on the number of relay terminals indicated by the fourth information saves wireless resources for relay connection establishment and relay communication.

[0283] Figure 7 is a signaling diagram of another relay connection establishment method provided in an embodiment of this application. As shown in Figure 7, the method includes:

[0284] S71, The first terminal sends a connection message to the first relay terminal.

[0285] The connection message includes: a terminal identifier and fifth indication information; the fifth indication information is the fourth indication information in the second discovery message sent by the first relay terminal. For example, in the scenario shown in Figure 1, the identifiers of the relay terminals corresponding to the fourth indication information are: the identifiers of the first relay terminal, the second relay terminal, and the third relay terminal. For example, in the scenario shown in Figure 2, the identifiers of the relay terminals corresponding to the fourth indication information are: the identifiers of the first relay terminal, the second relay terminal, the third relay terminal, and the second terminal.

[0286] In this embodiment, after the first terminal determines the first relay terminal based on the second information as described in step S65, the first terminal sends a connection message to the first relay terminal. This application does not limit the process of the first terminal sending the connection message to the first relay terminal. Optionally, the identifier of the first relay terminal can be determined based on the fifth indication information included in the connection message. Then, the layer 2 address of the first relay terminal can be determined based on the association between the identifier and the layer 2 address of the first relay terminal. Finally, the connection message is sent to the first relay terminal based on the layer 2 address of the first terminal.

[0287] S72. The relay terminal receives a connection message sent by the first terminal or another relay terminal;

[0288] The connection message includes: a terminal identifier and fifth indication information. The fifth indication information is the fourth indication information in the second discovery message sent by the first relay terminal;

[0289] For example:

[0290] S72a. The first relay terminal receives the connection message sent by the first terminal. The process of the first terminal sending the connection message to the first relay terminal can be referred to the description in step S71, and will not be repeated here.

[0291] S72b: The second relay terminal receives the connection message sent by the first relay terminal.

[0292] S72c: The third relay terminal receives the connection message sent by the second relay terminal.

[0293] S73. The relay terminal determines, based on the fifth instruction information, which other relay or second terminal will send the connection message to, and sends the connection message to it.

[0294] In this embodiment, the relay terminal determines the identifier of the relay terminal receiving the connection message based on the identifier of the relay terminal that sent the connection message and the fifth indication information. Furthermore, the relay terminal can send the connection message to the relay terminal that received the connection message based on the identifier of the relay terminal that received the connection message.

[0295] In one example, for the scenario shown in Figure 1, the fifth indication information is: the identifier of the first relay terminal, the identifier of the second relay terminal, and the identifier of the third relay terminal. Alternatively, for the scenario shown in Figure 2, the fifth indication information is: the identifier of the first relay terminal, the identifier of the second relay terminal, the identifier of the third relay terminal, and the identifier of the second terminal.

[0296] In this application, the process by which the relay terminal determines, based on the fifth instruction information, that the connection message will be sent to other relay terminals or the second terminal, and sends the connection message to them, is not limited.

[0297] Optionally, determining, based on the fifth instruction information, to send the connection message to other relays or second terminals, and sending the connection message to them, may include:

[0298] According to the fifth instruction information, if it is determined that the connection message will be sent to another relay terminal, then the connection message is unicast to that relay terminal. Specifically, the relay terminal determines the identifier of the receiving relay terminal based on the identifier of the relay terminal that sent the connection message and the fifth instruction information. If the identifier of the receiving relay terminal corresponds to another relay terminal, then the Layer 2 address of the receiving relay terminal can be determined based on the identifier of the receiving relay terminal, and further, the connection address is unicast to the receiving relay terminal based on the Layer 2 address of the receiving relay terminal. For example, in the scenario shown in Figure 1, or in the scenario shown in Figure 2, the other relay terminals include one of the first relay terminal, the second relay terminal, and the third relay terminal.

[0299] According to the fifth instruction information, if it is determined that a connection message will be sent to the second terminal, then the connection message is sent to the second terminal device according to its type. Specifically, the relay terminal determines the identifier of the relay terminal receiving the connection message based on the identifier of the relay terminal sending the connection message and the fifth instruction information. If the identifier of the relay terminal receiving the connection message corresponds to the second terminal, then the connection message is sent to the second terminal device according to its type. The types of the second terminal devices include relay devices and terminal devices. For example, in the scenario shown in Figure 1, the type of the second terminal device is a terminal device; in the scenario shown in Figure 2, the type of the second terminal device is a relay device. This application does not limit the process of sending a connection message to the second terminal device according to its type. Optionally, sending a connection message to the second terminal device according to its type may include:

[0300] If the second terminal device is a relay device, a connection message is unicast to it. Specifically, if the second terminal device is a relay device, its Layer 2 address can be determined based on the association between its identifier and Layer 2 address. Furthermore, a connection message can be unicast to the second terminal based on its Layer 2 address. If the second terminal device is a terminal device, a connection message is broadcast. Specifically, if the second terminal device is a terminal device, and the association between its identifier and Layer 2 address cannot be obtained, a connection message can be broadcast so that the second terminal receives the connection message broadcast by the relay device.

[0301] For example:

[0302] S73a. The first relay terminal determines, based on the fifth indication information, that the connection message will be sent to the second relay terminal, and sends the connection message to it. Specifically, the first relay terminal determines, based on its own identifier and the fifth indication information, that the identifier of the relay terminal receiving the connection message is the identifier of the second relay terminal. Further, based on the association between the identifier of the second relay terminal and the layer 2 address of the second relay terminal, the first relay terminal determines the layer 2 address of the second relay terminal, and then sends the connection message to the second relay terminal based on the layer 2 address of the second relay terminal.

[0303] S73b: The second relay terminal determines, based on the fifth instruction information, that the connection message will be sent to the third relay terminal, and sends the connection message to it. Specifically, the second relay terminal determines, based on its own identifier and the fifth instruction information, that the identifier of the relay terminal receiving the connection message is the identifier of the third relay terminal. Further, based on the association between the identifier of the third relay terminal and its Layer 2 address, it determines the Layer 2 address of the third relay terminal, and then sends the connection message to the third relay terminal based on the Layer 2 address.

[0304] S73c: The third relay terminal, based on the fifth indication information, determines that the connection message will be sent to the second terminal and sends the connection message to it. Specifically, in the scenario shown in Figure 1, the third relay terminal, based on its identifier and the fifth indication information, determines that it is the last relay terminal, and the connection message will be sent to the second terminal. At this time, the association between the second terminal's identifier and its Layer 2 address cannot be obtained. Optionally, the third terminal can broadcast the connection message so that the second terminal can receive the connection message broadcast by the third relay terminal. In the scenario shown in Figure 2, the third relay terminal, based on its identifier and the fifth indication information, determines that the identifier of the relay terminal receiving the connection message is the identifier of the second terminal. Further, based on the association between the second terminal's identifier and its Layer 2 address, it determines the Layer 2 address of the second terminal and then sends the connection message to the second terminal based on the Layer 2 address.

[0305] S74. The second terminal receives a connection message sent by the relay terminal; the connection message includes: terminal identifier and fifth indication information;

[0306] The fifth indication information is the fourth indication information in the second discovery message sent by the first relay terminal; the first relay terminal is the relay terminal determined according to the second information, and the second information is the information received by the first terminal including the second discovery message sent by each of the multiple relay terminals;

[0307] In this embodiment, the relay terminal determines, based on the fifth indication information, that the connection message will be sent to other relay terminals or the second terminal, and sends the connection message to them. The second terminal then receives the connection message sent by the relay terminal. Specifically, in the scenario shown in Figure 1, the second terminal receives the connection message sent by the relay terminal based on its Layer 2 address. In the scenario shown in Figure 2, the second terminal receives the connection message broadcast by the relay terminal.

[0308] For example:

[0309] S74a: The second terminal receives a connection message sent by the third relay terminal. The connection message includes a terminal identifier and fifth indication information. Specifically, in the scenario shown in Figure 1, the second terminal receives a connection message sent by the third relay terminal based on the second terminal's Layer 2 address. In the scenario shown in Figure 2, the second terminal receives a connection message broadcast by the third relay terminal.

[0310] S75. The second terminal generates a connection response message corresponding to the connection message based on the terminal identifier and the fifth indication information included in the connection message, and determines the relay terminal corresponding to the connection response message.

[0311] Optionally, the connection response message includes: a terminal identifier, an identifier of the second terminal or relay terminal that sent the connection response message, and an identifier of the relay terminal or the first terminal that received the connection response message.

[0312] In this embodiment, the second terminal can generate a connection response message corresponding to the connection message based on the terminal identifier and the fifth indication information included in the connection message. The connection response message generated by the second terminal includes: a terminal identifier, an identifier of the second terminal, and an identifier of the relay terminal receiving the connection response message. The relay terminal corresponding to the identifier of the relay terminal receiving the connection response message is determined to be the relay terminal corresponding to the connection response message.

[0313] For example:

[0314] S75a: The second terminal generates a connection response message corresponding to the connection message based on the terminal identifier and the fifth indication information included in the connection message, and determines the third relay terminal corresponding to the connection response message. The connection response message generated by the second terminal includes: the terminal identifier, the identifier of the second terminal, and the identifier of the third relay terminal.

[0315] S76. The second terminal sends the connection response message to the relay terminal corresponding to the connection response message.

[0316] In this embodiment, after the second terminal generates a connection response message corresponding to the connection message based on the terminal identifier and the fifth indication information included in the connection message, and determines the relay terminal corresponding to the connection response message, the second terminal can send the connection response message to the relay terminal corresponding to the connection response message. This application does not limit the process by which the second terminal sends the connection response message to the relay terminal corresponding to the connection response message. Optionally, the layer 2 address of the relay terminal corresponding to the connection response message can be determined based on the association between the identifier of the relay terminal receiving the connection response message and the layer 2 address of the relay terminal corresponding to the connection response message. Further, the second terminal can send the connection response message to the relay terminal corresponding to the connection response message based on the layer 2 address of the relay terminal corresponding to the connection response message.

[0317] For example:

[0318] S56a. The second terminal sends the connection response message to the third relay terminal corresponding to the connection response message. Specifically, the second terminal can determine the layer 2 address of the third relay terminal corresponding to the connection response message based on the identifier of the relay terminal corresponding to the connection response message (i.e., the third relay terminal) and the association relationship between the layer 2 address of the third relay terminal. Further, the second terminal can send the connection response message to the third relay terminal based on the layer 2 address of the third relay terminal.

[0319] S77. The relay terminal receives a connection response message sent by the second terminal or other relay terminals.

[0320] The connection response message is a response message to the connection message; the connection response message includes: the terminal identifier and the identifier of the relay terminal that sent the connection response message;

[0321] In this embodiment, the process by which a relay terminal receives a connection response message sent by a second terminal or another relay terminal can refer to the process described in step S76 whereby the second terminal sends a connection response message to the relay terminal corresponding to the connection response message. Optionally, the relay terminal can receive a connection response message sent by a second terminal or another relay terminal through its Layer 2 address. In one example, if the connection response message received by the relay terminal includes the identifier of the second terminal that sent the connection response message, then the connection response message received by the relay terminal is the connection response message sent by the second terminal.

[0322] In one example, if the connection response message received by the relay terminal includes the identifier of another relay terminal that sent the connection response message, then the connection response message received by the relay terminal is a connection response message sent by the other relay terminal. In this embodiment, the connection response message sent by the other relay terminal is a connection response message regenerated based on the connection response message sent by the second terminal. This application does not limit the process of regenerating the connection response message. Optionally, the connection message corresponding to the connection response message received by the relay terminal can be determined based on the terminal identifier, the identifier of the second terminal that sent the connection response message, and the identifier of the relay terminal that received the connection response message, all included in the connection response message sent by the second terminal. Furthermore, based on the fifth indication information included in the connection response message, the identifier of the first terminal or relay terminal that received the connection response message included in the regenerated connection response message can be determined, and the connection response message can be further regenerated.

[0323] For example:

[0324] S77a, the third relay terminal receives a connection response message sent by the second terminal. The connection response message sent by the second terminal includes: a terminal identifier, an identifier of the second terminal, and an identifier of the third relay terminal. In one example, the third relay terminal regenerates a connection response message based on the connection response message sent by the second terminal and the corresponding connection message. Optionally, the third relay terminal determines the identifier of the second relay terminal receiving the connection response message, which is included in the connection response message generated by the third relay terminal, based on the connection response message sent by the second terminal and the corresponding connection message, and further determines the connection response message generated by the third relay terminal.

[0325] S77b, the second relay terminal receives a connection response message sent by the third relay terminal. The connection response message sent by the third relay terminal includes: a terminal identifier, an identifier of the third relay terminal, and an identifier of the second relay terminal. In one example, the second relay terminal regenerates a connection response message based on the connection response message sent by the third relay terminal and the corresponding connection message. Optionally, the second relay terminal determines the identifier of the first relay terminal receiving the connection response message included in the connection response message generated by the second relay terminal, based on the connection response message sent by the third terminal and the corresponding connection message, and further determines the connection response message generated by the second relay terminal.

[0326] S77c, the first relay terminal receives a connection response message sent by the second relay terminal. The connection response message sent by the second relay terminal includes: a terminal identifier, an identifier of the second terminal, and an identifier of the first relay terminal. In one example, the first relay terminal regenerates a connection response message based on the connection response message sent by the second relay terminal and the corresponding connection message. Optionally, the first relay terminal determines the identifier of the first terminal receiving the connection response message included in the connection response message generated by the first relay terminal, based on the connection response message sent by the second terminal and the corresponding connection message, and further determines the connection response message generated by the first relay terminal.

[0327] S78. The relay terminal sends the connection response message to the first terminal or other relay terminals according to the terminal identifier and the identifier of the relay terminal that sent the connection response message included in the connection response message.

[0328] In this embodiment, the relay terminal sends the regenerated connection response message to the first terminal or other relay terminals based on the terminal identifier and the identifier of the relay terminal that sent the connection response message, which are included in the connection response message. This process can refer to the process described in step S76 where the second terminal sends the connection response message to the relay terminal corresponding to the connection response message. Optionally, the relay terminal can determine the Layer 2 address of the relay terminal receiving the connection response message based on its identifier. Further, it can send the regenerated connection response message to the first terminal or other relay terminals based on the Layer 2 address of the relay terminal receiving the connection response message.

[0329] For example:

[0330] S78a. The third relay terminal sends the connection response message to the second relay terminal based on the terminal identifier included in the connection response message and the identifier of the relay terminal receiving the connection response message. As described in step S77b, the connection response message sent by the third relay terminal includes: a terminal identifier, the identifier of the third relay terminal, and the identifier of the second relay terminal. Optionally, the third relay terminal sends the connection response message to the second relay terminal based on the terminal identifier included in the connection response message and the identifier of the second relay terminal receiving the connection response message. Specifically, the third relay terminal can determine the Layer 2 address of the second relay terminal based on the identifier of the second relay terminal receiving the connection response message, and further, can send the regenerated connection response message from the third relay terminal to the second relay terminal based on the Layer 2 address of the second relay terminal.

[0331] S78b: The second relay terminal sends the connection response message to the first relay terminal based on the terminal identifier included in the connection response message and the identifier of the relay terminal receiving the connection response message. As described in step S77c, the connection response message sent by the second relay terminal includes: a terminal identifier, the identifier of the second relay terminal, and the identifier of the first relay terminal. Optionally, the second relay terminal sends the connection response message to the first relay terminal based on the terminal identifier included in the connection response message and the identifier of the first relay terminal receiving the connection response message. Specifically, the second relay terminal can determine the Layer 2 address of the first relay terminal based on the identifier of the first relay terminal receiving the connection response message, and further, can send the regenerated connection response message of the second relay terminal to the first relay terminal based on the Layer 2 address of the first relay terminal.

[0332] S78c, the first relay terminal sends the connection response message to the first terminal based on the terminal identifier included in the connection response message and the identifier of the relay terminal receiving the connection response message. As described in step S77, the connection response message sent by the first relay terminal includes: a terminal identifier, the identifier of the first terminal, and the identifier of the first terminal. Optionally, the first relay terminal sends the connection response message to the first terminal based on the terminal identifier included in the connection response message and the identifier of the first terminal receiving the connection response message. Specifically, the first relay terminal can determine the Layer 2 address of the first terminal based on the identifier of the first terminal receiving the connection response message, and further, can send the regenerated connection response message to the first terminal based on the Layer 2 address of the first terminal.

[0333] S79. The first terminal receives the connection response message sent by the first relay terminal.

[0334] The connection response message is a response message to the connection message. In this embodiment, the process of the first terminal receiving the connection response message sent by the first relay terminal can refer to the process described in step S78 whereby the relay terminal sends the connection response message to the first terminal or other relay terminals based on the terminal identifier included in the connection response message and the identifier of the relay terminal receiving the connection response message. Optionally, the first terminal receives the connection response message sent by the first intermediate terminal based on the layer 2 address of the first terminal.

[0335] In this embodiment, the terminal identifier includes: a first terminal identifier and a second terminal identifier, or the terminal identifier includes: a first terminal identifier. Specifically, in U2U communication, the terminal identifier includes: a first terminal identifier and a second terminal identifier; in U2N communication, the terminal identifier includes: a first terminal identifier.

[0336] In this embodiment, the connection message includes: a terminal identifier and a fifth indication information; the fifth indication information is the fourth indication information in the second discovery message sent by the first relay terminal. During the process of the first terminal sending a connection message to the first relay terminal and the relay terminal sending a connection message to other relay terminals or second terminals, the relay terminal or second terminal to be sent is determined according to the fifth indication information in the connection message, which improves the accuracy of relay connection, saves the signaling overhead of the connection establishment process, and further improves the quality of relay communication.

[0337] Figure 8 is a flowchart of another relay connection establishment method provided in an embodiment of this application. As shown in Figure 8, the relay connection establishment method provided in this embodiment of the application is executed by a relay terminal, and the method includes:

[0338] S801, the relay terminal receives connection messages sent by the first terminal or other relay terminals.

[0339] The connection message includes: terminal identifier and second indication information; the second indication information is the first indication information in the discovery response message sent by the first relay terminal; the first relay terminal is a relay terminal determined according to the first information, and the first information is the information received by the first terminal including the discovery response message sent by each of the multiple relay terminals;

[0340] For a detailed description of this step, please refer to step S52. This step will not be repeated here.

[0341] S802. The relay terminal determines, based on the second instruction information, that the connection message will be sent to other relay terminals or the second terminal, and sends the connection message to them.

[0342] For a detailed description of this step, please refer to step S53. This step will not be repeated here.

[0343] In this embodiment, the connection message includes: terminal identifier and second indication information; the second indication information is the first indication information in the discovery message sent by the first relay terminal. The relay terminal determines, according to the second indication information, that the connection message will be sent to other relay terminals or the second terminal, and sends the connection message to them, thereby improving the accuracy of relay connection, saving signaling overhead in the connection establishment process, and further improving the quality of relay communication.

[0344] Figure 9 is a flowchart of another relay connection establishment method provided in an embodiment of this application. As shown in Figure 9, the relay connection establishment method provided in this embodiment of the application is executed by a relay terminal, and the method includes:

[0345] S901, The relay terminal receives a connection message sent by the first terminal or other relay terminals.

[0346] The connection message includes: terminal identifier and fifth indication information; the fifth indication information is the fifth indication information and the fourth indication information in the second discovery message sent by the first relay terminal;

[0347] For a detailed description of this step, please refer to step S77. This step will not be repeated here.

[0348] S902. The relay terminal determines, based on the fifth instruction information, which other relay or second terminal will send the connection message to, and sends the connection message to it.

[0349] For a detailed description of this step, please refer to step S78. This step will not be repeated here.

[0350] In this embodiment, the connection message includes: terminal identifier and second indication information; the fifth indication information is the fourth indication information in the second discovery message sent by the first relay terminal. The relay terminal determines the other relay or second terminal to which the connection message will be sent based on the fifth indication information, and sends the connection message to them, thereby improving the accuracy of the relay connection, saving the signaling overhead of the connection establishment process, and further improving the quality of relay communication.

[0351] Figure 10 is a flowchart of another relay connection establishment method provided in an embodiment of this application. As shown in Figure 10, the relay connection establishment method provided in this embodiment of the application is executed by a second terminal, and the method includes:

[0352] S1001, The second terminal receives the connection message sent by the relay terminal.

[0353] The connection message includes: terminal identifier and second indication information; the second indication information is the first indication information in the discovery response message sent by the first relay terminal; the first relay terminal is a relay terminal determined according to the first information, and the first information is the information received by the first terminal including the discovery response message sent by each of the multiple relay terminals;

[0354] For a detailed description of this step, please refer to step S54. This step will not be repeated here.

[0355] S1002, the second terminal generates a connection response message corresponding to the connection message based on the terminal identifier and the second indication information included in the connection message, and determines the relay terminal corresponding to the connection response message.

[0356] For a detailed description of this step, please refer to step S55. This step will not be repeated here.

[0357] S1003, the second terminal sends the connection response message to the relay terminal corresponding to the connection response message.

[0358] For a detailed description of this step, please refer to the description in step S56. This step will not be repeated here.

[0359] In this embodiment, the connection message includes: a terminal identifier and second indication information; the second indication information is the first indication information in the discovery message sent by the first relay terminal. The second terminal generates a connection response message corresponding to the connection message based on the terminal identifier and the second indication information included in the connection message, and determines the relay terminal corresponding to the connection response message. This improves the accuracy of relay connection, saves signaling overhead in the connection establishment process, and further improves the quality of relay communication.

[0360] Figure 11 is a flowchart of another relay connection establishment method provided in an embodiment of this application. As shown in Figure 11, the relay connection establishment method provided in this embodiment of the application is executed by a second terminal, and the method includes:

[0361] S1101, The second terminal receives a connection message sent by the relay terminal; the connection message includes: terminal identifier and fifth indication information.

[0362] The fifth indication information is the fourth indication information in the second discovery message sent by the first relay terminal; the first relay terminal is the relay terminal determined according to the second information, and the second information is the information received by the first terminal including the second discovery message sent by each of the multiple relay terminals;

[0363] For a detailed description of this step, please refer to step S74. This step will not be repeated here.

[0364] S1102. The second terminal generates a connection response message corresponding to the connection message based on the terminal identifier and the fifth indication information included in the connection message, and determines the relay terminal corresponding to the connection response message.

[0365] For a detailed description of this step, please refer to the description in step S75. This step will not be repeated here.

[0366] S1103, The second terminal sends the connection response message to the relay terminal corresponding to the connection response message.

[0367] For a detailed description of this step, please refer to the description in step S76. This step will not be repeated here.

[0368] In this embodiment, the connection message includes: a terminal identifier and second indication information; the fifth indication information is the fourth indication information in the second discovery message sent by the first relay terminal. The second terminal generates a connection response message corresponding to the connection message based on the terminal identifier and the fifth indication information included in the connection message, and determines the relay terminal corresponding to the connection response message. This improves the accuracy of relay connection, saves signaling overhead in the connection establishment process, and further improves the quality of relay communication.

[0369] The measurement method provided in the embodiments of this application has been described in detail above with reference to the accompanying drawings. The apparatus provided in the embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0370] Figures 12 to 14 are schematic block diagrams of possible relay connection establishment devices provided in the embodiments of this application. These relay connection devices can be used to implement the functions of the first terminal, relay terminal, or second terminal in the above method embodiments, and thus can also achieve the beneficial effects of the above method embodiments. In the embodiments of this application, the relay connection device can be the first terminal, relay terminal, or second terminal in any of the method embodiments shown in Figures 3 to 11, or it can be a component (such as a chip, chip system, processor, etc.) configured in a terminal or network device, or it can be a logic module or software capable of implementing some or all of the functions of the terminal or network device.

[0371] In one example, FIG12 shows a schematic block diagram of a relay connection establishment device 1200 on the first terminal side according to an embodiment of the present application. As shown in FIG12, the relay connection establishment device 1200 includes a transceiver unit 1210 and a processing unit 1220.

[0372] One possible design is that the relay connection establishment device 1200 is used to implement the function of the first terminal in any of the method embodiments shown in Figures 3 to 11. A more detailed description of the transceiver unit 1210 and the processing unit 1220 can be obtained directly from the relevant descriptions in any of the method embodiments shown in Figures 3 to 11, and will not be repeated here.

[0373] It should be noted that the transceiver unit can also be called a transceiver module, transceiver, transceiver machine, or transceiver device, etc. The processing unit can also be called a processor, processing board, processing module, or processing device, etc. Optionally, the transceiver unit is used to perform the sending and receiving operations on the terminal or network device side in the above method. The device in the communication module used to implement the receiving function can be considered as the receiving unit, and the device in the communication module used to implement the sending function can be considered as the sending unit; that is, the transceiver unit includes both a receiving unit and a sending unit.

[0374] It should also be noted that, in one possible design, the aforementioned transceiver unit and / or processing unit can be implemented through virtual modules. For example, the processing unit can be implemented through software functional units or virtual devices, and the transceiver unit can be implemented through software functions or virtual devices. In another possible design, the processing unit or transceiver unit can also be implemented through physical devices. For example, if the device is implemented using a chip / chip circuit, the transceiver unit can be an input / output circuit and / or a communication interface, performing input operations (corresponding to the aforementioned receiving operation) and output operations (corresponding to the aforementioned sending operation); the processing unit is an integrated processor, microprocessor, or integrated circuit.

[0375] The unit division in this embodiment is illustrative and represents only one logical functional division; in actual implementation, other division methods may be used. Furthermore, the functional modules in the various examples of this embodiment can be integrated into a single processor, exist as separate physical entities, or be integrated into a single module. The integrated modules can be implemented in hardware or as software functional modules.

[0376] In one example, FIG13 shows a schematic block diagram of a relay connection establishment apparatus 1300 on the relay terminal side according to an embodiment of the present application. As shown in FIG13, the relay connection establishment apparatus 1300 includes a transceiver unit 1310 and a processing unit 1320.

[0377] One possible design is that the relay connection establishment device 1300 is used to implement the function of the relay terminal in any of the method embodiments shown in Figures 3 to 11. A more detailed description of the transceiver unit 1310 and the processing unit 1320 can be obtained directly from the relevant descriptions in any of the method embodiments shown in Figures 3 to 11, and will not be repeated here.

[0378] It should be noted that the transceiver unit can also be called a transceiver module, transceiver, transceiver machine, or transceiver device, etc. The processing unit can also be called a processor, processing board, processing module, or processing device, etc. Optionally, the transceiver unit is used to perform the sending and receiving operations on the terminal or network device side in the above method. The device in the communication module used to implement the receiving function can be considered as the receiving unit, and the device in the communication module used to implement the sending function can be considered as the sending unit; that is, the transceiver unit includes both a receiving unit and a sending unit.

[0379] It should also be noted that, in one possible design, the aforementioned transceiver unit and / or processing unit can be implemented through virtual modules. For example, the processing unit can be implemented through software functional units or virtual devices, and the transceiver unit can be implemented through software functions or virtual devices. In another possible design, the processing unit or transceiver unit can also be implemented through physical devices. For example, if the device is implemented using a chip / chip circuit, the transceiver unit can be an input / output circuit and / or a communication interface, performing input operations (corresponding to the aforementioned receiving operation) and output operations (corresponding to the aforementioned sending operation); the processing unit is an integrated processor, microprocessor, or integrated circuit.

[0380] The unit division in this embodiment is illustrative and represents only one logical functional division; in actual implementation, other division methods may be used. Furthermore, the functional modules in the various examples of this embodiment can be integrated into a single processor, exist as separate physical entities, or be integrated into a single module. The integrated modules can be implemented in hardware or as software functional modules.

[0381] In one example, FIG14 shows a schematic block diagram of a relay connection establishment apparatus 1400 on the second terminal side according to an embodiment of the present application. As shown in FIG14, the relay connection establishment apparatus 1400 includes a transceiver unit 1410 and a processing unit 1420.

[0382] One possible design is that the relay connection establishment device 1400 is used to implement the function of the relay terminal in any of the method embodiments shown in Figures 3 to 11. A more detailed description of the transceiver unit 1410 and the processing unit 1420 can be obtained directly from the relevant descriptions in any of the method embodiments shown in Figures 3 to 11, and will not be repeated here.

[0383] It should be noted that the transceiver unit can also be called a transceiver module, transceiver, transceiver machine, or transceiver device, etc. The processing unit can also be called a processor, processing board, processing module, or processing device, etc. Optionally, the transceiver unit is used to perform the sending and receiving operations on the terminal or network device side in the above method. The device in the communication module used to implement the receiving function can be considered as the receiving unit, and the device in the communication module used to implement the sending function can be considered as the sending unit; that is, the transceiver unit includes both a receiving unit and a sending unit.

[0384] It should also be noted that, in one possible design, the aforementioned transceiver unit and / or processing unit can be implemented through virtual modules. For example, the processing unit can be implemented through software functional units or virtual devices, and the transceiver unit can be implemented through software functions or virtual devices. In another possible design, the processing unit or transceiver unit can also be implemented through physical devices. For example, if the device is implemented using a chip / chip circuit, the transceiver unit can be an input / output circuit and / or a communication interface, performing input operations (corresponding to the aforementioned receiving operation) and output operations (corresponding to the aforementioned sending operation); the processing unit is an integrated processor, microprocessor, or integrated circuit.

[0385] The unit division in this embodiment is illustrative and represents only one logical functional division; in actual implementation, other division methods may be used. Furthermore, the functional modules in the various examples of this embodiment can be integrated into a single processor, exist as separate physical entities, or be integrated into a single module. The integrated modules can be implemented in hardware or as software functional modules.

[0386] Figures 15 to 17 are schematic block diagrams of possible relay connection establishment devices provided in the embodiments of this application. These relay connection establishment devices can be used to implement the functions of the first terminal, relay terminal, or second terminal in the above method embodiments, and thus can also achieve the beneficial effects of the above method embodiments. In the embodiments of this application, the relay connection establishment device can be the first terminal, relay terminal, or second terminal in any of the method embodiments shown in Figures 3 to 11, or it can be a component (such as a chip, chip system, processor, etc.) configured in a terminal or network device, or it can be a logic module or software capable of implementing some or all of the functions of the terminal or network device.

[0387] In one example, FIG15 shows a schematic block diagram of a relay connection establishment device 1500 on the first terminal side according to an embodiment of the present application. As shown in FIG15, the relay connection establishment device 1500 includes a processor 1510. The processor 1510 can be used to execute computer programs or instructions in memory to implement the steps performed by the first terminal in any of the method embodiments shown in FIG3 to FIG11.

[0388] Optionally, the relay connection establishment device 1500 also includes a communication interface 1520. The processor 1510 and the communication interface 1520 are coupled to each other. It is understood that the communication interface 1520 can be a transceiver or an input / output interface.

[0389] Optionally, the relay connection establishment device 1500 may further include a memory 1530 for storing instructions executed by the processor 1510, or storing input data required by the processor 1510 to run instructions, or storing data generated after the processor 1510 runs instructions.

[0390] When the relay connection establishment device 1500 is used to implement the method shown in any of Figures 3 to 11, the processor 1510 is used to execute the function of the processing unit 1210, and the communication interface 1520 is used to execute the function of the transceiver unit 1220. Whether the communication interface 1520 is used for sending or receiving depends on whether the communication device 1500 is used to perform a sending or receiving action in the scheme it executes.

[0391] When the aforementioned relay connection establishment device 1500 is a chip applied to a terminal, the chip implements the functions of the terminal in the above method embodiments. The terminal's chip receives signals from other modules (such as radio frequency modules or antennas) in the terminal, and these signals may be sent to the terminal by network devices; or, the terminal's chip sends signals to other modules (such as radio frequency modules or antennas) in the terminal, and these signals may be sent to network devices by the terminal.

[0392] It is understandable that when the relay connection establishment device 1500 is the first terminal, the communication interface 1520 can be a transceiver, specifically including a transmitter and a receiver. The transmitter is used to send signals, and the receiver is used to receive signals. When the relay connection establishment device 1500 is a chip applied to the terminal, the communication interface 1520 can be an input / output circuit, a bus, a module, a pin, or other types of communication interface. The input circuit in the input / output circuit can be used for receiving, and the output interface can be used for sending.

[0393] It should be understood that in the relay connection establishment device 1500 shown in Figure 15, the processor 1510 may correspond to the processing unit 1210 in the relay connection establishment device 1200 mentioned above, and the communication interface 1520 may correspond to the transceiver unit 1220 in the relay connection establishment device 1200 mentioned above.

[0394] It should also be understood that the coupling in the embodiments of this application is an indirect coupling or communication connection between devices, units, or modules, which can be electrical, mechanical, or other forms, used for information interaction between devices, units, or modules. The processor 1510 may operate in conjunction with the memory 1530. The embodiments of this application do not limit the specific connection medium between the processor 1510, the communication interface 1520, and the memory 1530.

[0395] Optionally, the processor 1510, communication interface 1520, and memory 1530 are interconnected via a bus. The bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be categorized as an address bus, data bus, control bus, etc.

[0396] In one example, FIG16 shows a schematic block diagram of a relay connection establishment device 1600 on the relay terminal side according to an embodiment of the present application. As shown in FIG16, the relay connection establishment device 1600 includes a processor 1610. The processor 1610 can be used to execute computer programs or instructions in memory to implement the steps performed by the relay terminal in any of the method embodiments shown in FIG3 to FIG11.

[0397] Optionally, the relay connection establishment device 1600 also includes a communication interface 1620. The processor 1610 and the communication interface 1620 are coupled to each other. It is understood that the communication interface 1620 can be a transceiver or an input / output interface.

[0398] Optionally, the relay connection establishment device 1600 may also include a memory 1630 for storing instructions executed by the processor 1610, or storing input data required by the processor 1610 to run instructions, or storing data generated after the processor 1610 runs instructions.

[0399] When the relay connection establishment device 1600 is used to implement the method shown in any of Figures 3 to 11, the processor 1610 is used to execute the function of the processing unit 1310, and the communication interface 1620 is used to execute the function of the transceiver unit 1320. Whether the communication interface 1620 is used for sending or receiving depends on whether the communication device 1600 is used to perform a sending or receiving action in the scheme it executes.

[0400] When the aforementioned relay connection establishment device 1600 is a chip applied to a terminal, the chip implements the functions of the terminal in the above method embodiments. The terminal's chip receives signals from other modules (such as radio frequency modules or antennas) in the terminal, and these signals may be sent to the terminal by network devices; or, the terminal's chip sends signals to other modules (such as radio frequency modules or antennas) in the terminal, and these signals may be sent to network devices by the terminal.

[0401] It is understandable that when the relay connection establishment device 1600 is a relay terminal, the communication interface 1620 can be a transceiver, specifically including a transmitter and a receiver. The transmitter is used to send signals, and the receiver is used to receive signals. When the relay connection establishment device 1600 is a chip applied to a terminal, the communication interface 1620 can be an input / output circuit, a bus, a module, a pin, or other types of communication interface. The input circuit in the input / output circuit can be used for receiving, and the output interface can be used for sending.

[0402] It should be understood that in the relay connection establishment device 1600 shown in Figure 16, the processor 1610 may correspond to the processing unit 1310 in the relay connection establishment device 1300 mentioned above, and the communication interface 1620 may correspond to the transceiver unit 1320 in the relay connection establishment device 1300 mentioned above.

[0403] It should also be understood that the coupling in the embodiments of this application is an indirect coupling or communication connection between devices, units, or modules, which can be electrical, mechanical, or other forms, used for information interaction between devices, units, or modules. The processor 1610 may operate in conjunction with the memory 1630. The embodiments of this application do not limit the specific connection medium between the processor 1610, the communication interface 1620, and the memory 1630.

[0404] Optionally, the processor 1610, communication interface 1620, and memory 1630 are interconnected via a bus. The bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be categorized as an address bus, data bus, control bus, etc.

[0405] In one example, FIG17 shows a schematic block diagram of a relay connection establishment device 1700 on the second terminal side according to an embodiment of the present application. As shown in FIG17, the relay connection establishment device 1700 includes a processor 1710. The processor 1710 can be used to execute computer programs or instructions in memory to implement the steps performed by the second terminal in any of the method embodiments shown in FIG3 to FIG11.

[0406] Optionally, the relay connection establishment device 1700 also includes a communication interface 1720. The processor 1710 and the communication interface 1720 are coupled to each other. It is understood that the communication interface 1720 can be a transceiver or an input / output interface.

[0407] Optionally, the relay connection establishment device 1700 may also include a memory 1730 for storing instructions executed by the processor 1710, or storing input data required by the processor 1710 to run instructions, or storing data generated after the processor 1710 runs instructions.

[0408] When the relay connection establishment device 1700 is used to implement the method shown in any of Figures 3 to 11, the processor 1710 is used to execute the function of the processing unit 1410, and the communication interface 1720 is used to execute the function of the transceiver unit 1420. Whether the communication interface 1720 is used for sending or receiving depends on whether the communication device 1700 is used to perform a sending or receiving action in the scheme it executes.

[0409] When the aforementioned relay connection establishment device 1700 is a chip applied to a terminal, the chip implements the functions of the terminal in the above method embodiments. The terminal's chip receives signals from other modules (such as radio frequency modules or antennas) in the terminal, and these signals may be sent to the terminal by network devices; or, the terminal's chip sends signals to other modules (such as radio frequency modules or antennas) in the terminal, and these signals may be sent to network devices by the terminal.

[0410] It is understandable that when the relay connection establishment device 1700 is a second terminal, the communication interface 1720 can be a transceiver, specifically including a transmitter and a receiver. The transmitter is used to send signals, and the receiver is used to receive signals. When the relay connection establishment device 1700 is a chip applied to a terminal, the communication interface 1720 can be an input / output circuit, a bus, a module, a pin, or other types of communication interface. The input circuit in the input / output circuit can be used for receiving, and the output interface can be used for sending.

[0411] It should be understood that in the relay connection establishment device 1700 shown in Figure 17, the processor 1710 may correspond to the processing unit 1410 in the relay connection establishment device 1400 mentioned above, and the communication interface 1720 may correspond to the transceiver unit 1420 in the relay connection establishment device 1400 mentioned above.

[0412] It should also be understood that the coupling in the embodiments of this application is an indirect coupling or communication connection between devices, units, or modules, which can be electrical, mechanical, or other forms, used for information interaction between devices, units, or modules. The processor 1710 may operate in conjunction with the memory 1730. The embodiments of this application do not limit the specific connection medium between the processor 1710, the communication interface 1720, and the memory 1730.

[0413] Optionally, the processor 1710, communication interface 1720, and memory 1730 are interconnected via a bus. The bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be categorized as an address bus, data bus, control bus, etc.

[0414] It is understood that the processor in the embodiments of this application can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. A general-purpose processor can be a microprocessor or any conventional processor.

[0415] The memory in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM). It should be noted that the memory used in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0416] This application also provides a relay connection establishment system, which includes the aforementioned first terminal, relay terminal and second terminal.

[0417] This application also provides a computer program product, which includes: a computer program (also referred to as code or instructions), which, when run, causes a computer to perform a method executed by a terminal or a method executed by a network device in the embodiments shown in Figures 3 to 11.

[0418] This application also provides a computer-readable storage medium storing a computer program (also referred to as code or instructions). When the computer program is run, it causes the computer to perform a method executed by a terminal or a network device in the embodiments shown in Figures 3 to 11.

[0419] The terms “unit”, “module”, etc., used in this specification may be used to refer to computer-related entities, hardware, firmware, combinations of hardware and software, software, or software in execution.

[0420] Those skilled in the art will recognize that the various illustrative logical blocks and steps described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application. In the several embodiments provided in this application, it should be understood that the disclosed apparatus, devices, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for example, the division of units is merely a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the shown or discussed mutual couplings or direct couplings or communication connections may be through some interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0421] The unit described as a separate component may or may not be physically separate. The component shown as a unit may or may not be a physical unit; that is, it may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0422] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0423] In the above embodiments, the functions of each functional unit can be implemented entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. This computer program product includes one or more computer instructions (programs). When the computer program instructions (programs) are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., digital video discs (DVDs)), or semiconductor media (e.g., solid-state disks (SSDs)).

[0424] If this function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.

[0425] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method of establishing a relay connection, characterized by Applied to the first terminal, including: Receive first information; wherein the first information includes a discovery response message sent by each of a plurality of relay terminals; the discovery response message is a response message to the first discovery message; the discovery response message includes first indication information and first discovery information; the first indication information is used to indicate the relay terminal through which the first discovery information passes; the first discovery information includes: terminal identifier and relay service code; the first discovery message is used by the first terminal to discover the second terminal; Based on the first information, a first relay terminal is determined, wherein the first relay terminal is one of the plurality of relay terminals; A connection message is sent to the first relay terminal; the connection message includes: a terminal identifier and second indication information; the second indication information is the first indication information in the discovery response message sent by the first relay terminal.

2. The method of claim 1, wherein, Based on the first information, the first relay terminal is determined, including: The first relay terminal is determined based on the first indication information in the first information.

3. The method according to claim 1 or 2, characterized in that, The discovery response message further includes a time-to-live value; and / or, the first information further includes the signal quality of the discovery response message; the time-to-live value is the numerical value of the time-to-live when the first discovery message corresponding to the discovery response message is responded to.

4. The method of claim 3, wherein, Based on the first information, the first relay terminal is determined, including: The first relay terminal is determined based on one or more of the following: the survival time value in the first information, the signal quality of the discovery response message, and the preset third indication information, and the first indication information; the preset third indication information is used to indicate the relay terminal that the first terminal wishes to select.

5. The method according to any one of claims 1-4, characterized in that, The method further includes: Broadcast the first discovery message; the first discovery message includes: first discovery information, first hop count information, and first indication information; wherein the first hop count information is used to limit the maximum number of hops for transmitting the first discovery information; the first indication information is used to indicate the relay terminals through which the first discovery information passes.

6. The method of claim 5, wherein, The method further includes: Receive a connection response message sent by the first relay terminal; wherein the connection response message is a response message to the connection message.

7. The method according to any one of claims 1 to 6, characterized in that, The terminal identifier includes: a first terminal identifier and a second terminal identifier, or the terminal identifier includes: a first terminal identifier.

8. A relay connection setup method, characterized by, Applied to the first terminal, including: Receive second information; wherein the second information includes a second discovery message broadcast by each of a plurality of relay terminals; the second discovery message is used by the first terminal to discover the second terminal; the second discovery message comes from the relay terminal, and the second discovery message includes: fourth indication information and second discovery information; the fourth indication information is used to indicate the relay terminal through which the second discovery information passes; the second discovery information includes: terminal identifier and relay service code; the second discovery information comes from the second terminal; Based on the second information, a first relay terminal is determined, wherein the first relay terminal is one of the plurality of relay terminals; A connection message is sent to the first relay terminal; the connection message includes: terminal identifier and fifth indication information; the fifth indication information is the fourth indication information in the second discovery message sent by the first relay terminal.

9. The method of claim 8, wherein, Based on the second information, the first relay terminal is determined, including: The first relay terminal is determined based on the fourth indication information in the second information.

10. The method according to claim 8 or 9, characterized in that, The second discovery message also includes second hop count information; and / or the second information also includes the signal quality of the second discovery message; the second hop count information is used to limit the maximum number of hops for transmitting the second discovery information.

11. The method of claim 10, wherein, Based on the second information, the first relay terminal is determined, including: The first relay terminal is determined based on one or more of the second hop count information, the signal quality of the second discovery message, the preset third indication information, and the fourth indication information in the second information; the preset third indication information is used to indicate the relay terminal that the first terminal wishes to select.

12. The method of claim 8, wherein, The method further includes: Receive a connection response message sent by the first relay terminal; wherein the connection response message is a response message to the connection message.

13. The method according to any one of claims 8-12, characterized in that, The terminal identifier includes: a first terminal identifier and a second terminal identifier, or the terminal identifier includes: a first terminal identifier.

14. A relay connection setup method, characterized by, Applications in relay terminals include: The system receives a connection message sent by a first terminal or other relay terminal; the connection message includes: a terminal identifier and second indication information; the second indication information is the first indication information in a discovery response message sent by the first relay terminal; the first relay terminal is a relay terminal determined according to the first information, and the first information is information received by the first terminal including discovery response messages sent by each of the multiple relay terminals; Based on the second instruction information, determine which other relay terminal or second terminal the connection message will be sent to, and send the connection message to it.

15. The method of claim 14, wherein, Based on the second indication information, determine which other relay or second terminal the connection message will be sent to, and send the connection message to it, including: According to the second instruction information, if it is determined that the connection message will be sent to other relay terminals, then the connection message is unicast to them; According to the second instruction information, if it is determined that a connection message will be sent to the second terminal, then a connection message is sent to the second terminal device according to the type of the second terminal device; wherein, the type of the second terminal device includes: relay device and terminal device.

16. The method of claim 15, wherein, Send a connection message to the second terminal device according to its type, including: If the second terminal device is a relay device, then a unicast connection message is sent to it; If the second terminal device is a terminal device, then a connection message is broadcast.

17. The method according to any one of claims 14-16, characterized by, The method further includes: The system receives a discovery response message sent by a second terminal or other relay terminal; the discovery response message is a response message to a first discovery message; the discovery response message includes first indication information and first discovery information; the first indication information is used to indicate the relay terminal through which the first discovery information passes; the first discovery information includes: terminal identifier and relay service code; the first discovery message is used by the first terminal to discover the second terminal; Based on the layer 2 address association, the discovery response message will be sent to the corresponding other relay terminals or the first terminal.

18. The method of any one of claims 14-16, wherein, The method further includes: Receive third information; wherein the third information includes a first discovery message broadcast by a first terminal or other relay terminal; the first discovery message includes: first discovery information, first hop count information, and first indication information; wherein the first hop count information is used to limit the maximum number of hops for transmitting the first discovery information; the first indication information is used to indicate the relay terminal through which the first discovery information passes; Based on the third information, a first discovery message to be sent is determined and broadcast.

19. The method of claim 18, wherein, The third information also includes the signal quality of the first discovery message; based on the third information, determining and broadcasting the first discovery message to be sent includes: Based on one or more of the first hop count information, the signal quality of the first discovery message, and the first indication information, determine and broadcast the first discovery message to be sent.

20. The method of any one of claims 14-16, wherein, The method further includes: Receive a connection response message sent by a second terminal or other relay terminal; wherein the connection response message is a response message to the connection message; the connection response message includes: a terminal identifier and an identifier of the relay terminal that sent the connection response message; Based on the terminal identifier and the identifier of the relay terminal receiving the connection response message included in the connection response message, the connection response message is sent to the first terminal or other relay terminals.

21. The method according to any one of claims 14-20, characterized by, The terminal identifier includes: a first terminal identifier and a second terminal identifier, or the terminal identifier includes: a first terminal identifier.

22. A method of establishing a relay connection, the method comprising: Applications in relay terminals include: Receive a connection message sent by a first terminal or other relay terminal; the connection message includes: a terminal identifier and fifth indication information; the fifth indication information is the fourth indication information in the second discovery message sent by the first relay terminal; Based on the fifth instruction information, determine which other relay or second terminal the connection message will be sent to, and send the connection message to it.

23. The method of claim 22, wherein, Based on the fifth indication information, determine which other relay or second terminal the connection message will be sent to, and send the connection message to it, including: According to the fifth instruction information, if it is determined that the connection message will be sent to other relay terminals, then the connection message is unicast to them; According to the fifth instruction information, if it is determined that a connection message will be sent to the second terminal, then a connection message is sent to the second terminal device according to the type of the second terminal device; wherein, the type of the second terminal device includes: relay device and terminal device.

24. The method of claim 23, wherein, Send a connection message to the second terminal device according to its type, including: If the second terminal device is a relay device, then a unicast connection message is sent to it; If the second terminal device is a relay device, a connection message is broadcast.

25. The method according to any one of claims 22-24, characterized by, The method further includes: A second discovery message is generated and broadcast; the second discovery message is used by the first terminal to discover the second terminal; the second discovery message includes: fourth indication information and second discovery information; the fourth indication information is used to indicate the relay terminal through which the second discovery information passes; the second discovery information includes: terminal identifier and relay service code; the second discovery information comes from the second terminal.

26. The method of claim 25, wherein, The method further includes: Receive fourth information; wherein, the fourth information includes a second discovery message broadcast by each of the plurality of other relay terminals; Based on the fourth information, a second discovery message to be sent is determined and broadcast.

27. The method of claim 26, wherein, Based on the fourth information, determine and broadcast the second discovery message to be sent, including: Based on the fourth instruction information, determine and broadcast the second discovery message to be sent.

28. The method of claim 26 or 27, wherein, The second discovery message also includes second hop count information; and / or the fourth information also includes the signal quality of the second discovery message; the second hop count information is used to limit the maximum number of hops for transmitting the second discovery information; Based on the fourth information, determine and broadcast the second discovery message to be sent, including: Based on one or more of the second hop count information and the signal quality of the second discovery message in the fourth information, and the fourth indication information, the second discovery message to be sent is determined and broadcast.

29. The method of any one of claims 22-24, wherein, The method further includes: Receive a connection response message sent by a second terminal or other relay terminal; wherein the connection response message is a response message to the connection message; the connection response message includes: a terminal identifier and an identifier of the relay terminal that sent the connection response message; Based on the terminal identifier and the identifier of the relay terminal that sent the connection response message, the connection response message is sent to the first terminal or other relay terminals.

30. The method of any one of claims 22-29, wherein, The terminal identifier includes: a first terminal identifier and a second terminal identifier, or the terminal identifier includes: a first terminal identifier.

31. A method of establishing a relay connection, the method comprising: Applied to the second terminal, including: The system receives a connection message sent by a relay terminal; the connection message includes: a terminal identifier and second indication information; the second indication information is the first indication information in a discovery response message sent by a first relay terminal; the first relay terminal is a relay terminal determined according to first information, and the first information is information received by the first terminal including discovery response messages sent by each of a plurality of relay terminals; Based on the terminal identifier and second indication information included in the connection message, a connection response message corresponding to the connection message is generated, and the relay terminal corresponding to the connection response message is determined. Send the connection response message to the relay terminal corresponding to the connection response message.

32. The method of claim 31, wherein, The connection response message includes a terminal identifier, the identifier of the second terminal or relay terminal that sent the connection response message, and the identifier of the relay terminal or the first terminal that received the connection response message.

33. The method of claim 31 or 32, wherein, The method further includes: Receive fifth information; wherein the fifth information includes a first discovery message broadcast by each of a plurality of relay terminals, the first discovery message including: first discovery information, first hop count information, and first indication information; wherein the first hop count information is used to limit the maximum number of hops for transmitting the first discovery information; the first indication information is used to indicate the relay terminals through which the first discovery information passes; Based on the fifth piece of information, the first discovery message to be responded to is determined; Generate a discovery response message for the first discovery message to be responded to; the discovery response message includes first indication information and first discovery information; the first indication information is used to indicate the relay terminal through which the first discovery information passes; the first discovery information includes: terminal identifier and relay service code; Based on the layer 2 address association, the discovery response message will be sent to the corresponding relay terminal.

34. The method of claim 33, wherein, Based on the fifth piece of information, the first discovery message to be responded to is determined, including: Based on the first hop count information and / or the first indication information, determine the first discovery message to be responded to.

35. The method of claim 33 or 34, wherein, The fifth piece of information also includes the signal quality of the first discovery message.

36. The method of claim 35, wherein, Based on the fifth piece of information, the first discovery message to be responded to is determined, including: Based on one or more of the first hop count information, the signal quality of the first discovery message, and the preset sixth indication information, and the first indication information, a first discovery message to be responded to is determined; the preset sixth indication information is used to indicate the relay terminal that the second terminal expects to select.

37. The method of any one of claims 31-36, wherein, The terminal identifier includes: a first terminal identifier and a second terminal identifier, or the terminal identifier includes: a first terminal identifier.

38. A method of establishing a relay connection, the method comprising: Applied to the second terminal, including: The system receives a connection message sent by a relay terminal; the connection message includes: a terminal identifier and fifth indication information; the fifth indication information is the fourth indication information in the second discovery message sent by the first relay terminal; the first relay terminal is a relay terminal determined according to the second information, and the second information is information received by the first terminal including the second discovery message sent by each of the multiple relay terminals; Based on the terminal identifier and fifth indication information included in the connection message, a connection response message corresponding to the connection message is generated, and the relay terminal corresponding to the connection response message is determined. Send the connection response message to the relay terminal corresponding to the connection response message.

39. The method of claim 38, wherein, The connection response message includes: a terminal identifier, an identifier of the second terminal or relay terminal that sent the connection response message, and an identifier of the relay terminal or the first terminal that received the connection response message.

40. The method of claim 38 or 39, wherein, The terminal identifier includes: a first terminal identifier and a second terminal identifier, or the terminal identifier includes: a first terminal identifier.

41. A relay connection setup device, characterized by, include: Processor, memory, and communication interface; The memory is used to store computer-executable program code, the program code including instructions; when the processor executes the instructions, the instructions cause the terminal device to perform the method as described in any one of claims 1-7, or the method as described in any one of claims 8-13, or the method as described in any one of claims 14-21, or the method as described in any one of claims 22-30, or the method as described in any one of claims 31-37, or the method as described in any one of claims 38-40.