Communication method and device

By enabling message exchange between relay devices to share or establish connections, the complexity of relay UE processing and the limitation on the number of links are resolved, link utilization efficiency is improved, and more UEs can communicate.

CN121333368APending Publication Date: 2026-01-13GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511497890.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-04-03
Publication Date
2026-01-13

AI Technical Summary

Technical Problem

As the number of links between the Relay UE and the initiating UE and/or the target UE increases, the processing complexity of the Relay UE increases, and the limited number of links restricts the number of UEs that can communicate.

Method used

Relay devices request to share or establish connections by sending and receiving messages, thereby sharing existing connections and improving link utilization efficiency.

Benefits of technology

By sharing existing connections, the link utilization efficiency between the relay device and the second device is improved, supporting communication between more initiating devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121333368A_ABST
    Figure CN121333368A_ABST
Patent Text Reader

Abstract

The application of the invention is a divisional application of 202380093165.5. The invention relates to a communication method, equipment, a computer readable storage medium, a computer program product and a computer program. The method comprises: a relay device receiving a first message sent by a first device, the first message being used for requesting a connection with a second device; the relay device sends a second message to the second device, the second message being used for requesting to share a first connection to transmit data between the first device and the second device, or the second message being used for sharing a second connection to transmit data between the first device and the second device. The second message is used for requesting to establish a second connection between the relay device and the second device to transmit data between the first device and the second device.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application. The parent application has the application number 202380093165.5, the application date is April 3, 2023, and the invention title is "Communication Method and Device". Technical Field

[0002] This application relates to the field of communications, and more specifically, to a communication method, apparatus, computer-readable storage medium, computer program product, and computer program. Background Technology

[0003] In related technologies, when two UEs (User Equipment) with ProSe (Proximity-based Services) capabilities are far apart and cannot establish communication directly, they can be relayed through a Relay UE with ProSe capabilities. That is, the two UEs with ProSe capabilities are called the initiating UE and the target UE, respectively, and the initiating UE and the target UE can interact with each other through the Relay UE.

[0004] As the number of initiating UEs and / or target UEs communicating via the Relay UE increases, the number of links also increases, thus increasing the processing complexity of the Relay UE. Furthermore, because the Relay UE can only handle a limited number of links, it also limits the number of initiating UEs and / or target UEs that can communicate through it. Therefore, how to share existing links between the Relay UE and the initiating UE and / or target UE becomes a problem that needs to be solved. Summary of the Invention

[0005] This application provides a communication method, a device, a computer-readable storage medium, a computer program product, and a computer program.

[0006] This application provides a communication method, including: The relay device receives a first message sent by the first device, wherein the first message is used to request a connection with the second device; The relay device sends a second message to the second device, wherein the second message is used to request sharing the first connection to transmit data between the first device and the second device, or the second message is used to request establishing a second connection between the relay device and the second device to transmit data between the first device and the second device.

[0007] This application provides a communication method, including: A first device sends a first message to a relay device, wherein the first message is used to request a connection with a second device, and the first message is used to trigger the relay device to send a second message to the second device, wherein the second message is used to request sharing a first connection to transmit data between the first device and the second device, or the second message is used to request establishing a second connection between the relay device and the second device to transmit data between the first device and the second device.

[0008] This application provides a communication method, including: The second device receives a second message sent by the relay device, wherein the second message is used to request sharing the first connection to transmit data between the first device and the second device, or the second message is used to request establishing a second connection between the relay device and the second device to transmit data between the first device and the second device.

[0009] This application provides a relay device, including: A first communication unit is configured to receive a first message sent by a first device, wherein the first message is used to request a connection with a second device; and to send a second message to the second device, wherein the second message is used to request sharing a first connection to transmit data between the first device and the second device, or the second message is used to request establishing a second connection between the relay device and the second device to transmit data between the first device and the second device.

[0010] This application provides a first device, including: The second communication unit is configured to send a first message to the relay device, wherein the first message is configured to request a connection with the second device, and the first message is configured to trigger the relay device to send a second message to the second device, wherein the second message is configured to request sharing a first connection to transmit data between the first device and the second device, or the second message is configured to request establishing a second connection between the relay device and the second device to transmit data between the first device and the second device.

[0011] This application provides a second device, including: The third communication unit is configured to receive a second message sent by the relay device, wherein the second message is configured to request sharing a first connection to transmit data between the first device and the second device, or the second message is configured to request establishing a second connection between the relay device and the second device to transmit data between the first device and the second device.

[0012] This application provides a relay device, including a transceiver, a processor, and a memory. The memory stores a computer program, and the processor calls and runs the computer program stored in the memory to cause the relay device to perform the methods described above.

[0013] This application provides a first device, including a transceiver, a processor, and a memory. The memory stores a computer program, and the processor calls and runs the computer program stored in the memory to cause the first device to perform the described method.

[0014] This application provides a second device, including a transceiver, a processor, and a memory. The memory stores a computer program, and the processor calls and runs the computer program stored in the memory to cause the second device to perform the above-described method.

[0015] This application provides a chip for implementing the above method.

[0016] Specifically, the chip includes a processor for retrieving and running a computer program from memory, causing a device equipped with the chip to perform the methods described above.

[0017] This application provides a computer-readable storage medium for storing a computer program, which, when run by a device, causes the device to perform the above-described method.

[0018] This application provides a computer program product, including computer program instructions that cause a computer to perform the above-described method.

[0019] This application provides a computer program that, when run on a computer, causes the computer to perform the above-described method.

[0020] As can be seen, by adopting the above scheme, when the first device needs to connect to the second device through the relay device, the relay device can determine whether to request to share the existing connection with the second device. In this way, the relay device can share the existing connection with the second device to serve multiple initiating devices, thereby improving the link utilization efficiency between the relay device and the second device. Attached Figure Description

[0021] Figure 1 This is a schematic diagram of an application scenario according to an embodiment of this application.

[0022] Figure 2 This is a 5G network system architecture diagram according to an embodiment of this application.

[0023] Figure 3 This is a schematic flowchart of a communication method according to an embodiment of this application.

[0024] Figure 4 This is a schematic flowchart of a communication method according to another embodiment of this application.

[0025] Figure 5 This is a schematic flowchart of a communication method according to another embodiment of this application.

[0026] Figures 6A-6B This is a schematic diagram illustrating various example processes of a communication method according to an embodiment of this application.

[0027] Figures 7A-7B This is a schematic diagram illustrating various example flows of a communication method according to another embodiment of this application.

[0028] Figure 8 This is a schematic diagram of the process for establishing a short-range link in related technologies.

[0029] Figures 9-10 This is a schematic diagram illustrating various scenarios in which a relay UE establishes a connection between an initiating UE and a target UE, based on relevant technologies.

[0030] Figure 11 This is a schematic diagram of a process initiating a connection between a UE and a target UE through a relay UE.

[0031] Figure 12 This is a schematic block diagram of a relay device according to an embodiment of this application.

[0032] Figure 13 This is a schematic block diagram of a relay device according to another embodiment of this application.

[0033] Figure 14 This is a schematic block diagram of a first device according to an embodiment of the present application.

[0034] Figure 15 This is a schematic block diagram of a first device according to another embodiment of this application.

[0035] Figure 16 This is a schematic block diagram of a second device according to an embodiment of this application.

[0036] Figure 17 This is a schematic block diagram of a second device according to another embodiment of this application.

[0037] Figure 18 This is a schematic block diagram of a communication device according to an embodiment of this application.

[0038] Figure 19 This is a schematic block diagram of a chip according to an embodiment of this application.

[0039] Figure 20This is a schematic block diagram of a communication system according to an embodiment of this application. Detailed Implementation

[0040] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.

[0041] The technical solutions of this application embodiment can be applied to various communication systems, such as: Global System of Mobile communication (GSM) system, Code Division Multiple Access (CDMA) system, Wideband Code Division Multiple Access (WCDMA) system, General Packet Radio Service (GPRS), Long Term Evolution (LTE) system, Advanced Long Term Evolution (LTE-A) system, New Radio (NR) system, evolution of NR system, LTE-based access to unlicensed spectrum (LTE-U) system, NR-based access to unlicensed spectrum (NR-U) system, Non-Terrestrial Networks (NTN) system, Universal Mobile Telecommunication System (UMTS), Wireless Local Area Networks (WLAN), and Wireless Fidelity (WF). Fidelity (WiFi), 5th-Generation (5G) communication systems, or other communication systems.

[0042] Traditional communication systems typically support a limited number of connections and are easy to implement. However, with the development of communication technology, mobile communication systems will not only support traditional communication but also, for example, device-to-device (D2D) communication, machine-to-machine (M2M) communication, machine-type communication (MTC), vehicle-to-vehicle (V2V) communication, or vehicle-to-everything (V2X) communication. The embodiments of this application can also be applied to these communication systems.

[0043] In one possible implementation, the communication system in this application embodiment can be applied to a carrier aggregation (CA) scenario, a dual connectivity (DC) scenario, or a standalone (SA) network deployment scenario.

[0044] In one possible implementation, the communication system in this application embodiment can be applied to unlicensed spectrum, wherein the unlicensed spectrum can also be considered as shared spectrum; or, the communication system in this application embodiment can also be applied to licensed spectrum, wherein the licensed spectrum can also be considered as non-shared spectrum.

[0045] Figure 1 An exemplary communication system 100 is shown. The communication system includes a network device 110 and two terminal devices 120. In one possible implementation, the communication system 100 may include multiple network devices 110, and the coverage area of ​​each network device 110 may include other numbers of terminal devices 120, which is not limited in this application embodiment.

[0046] In one possible implementation, the communication system 100 may also include other network entities such as a Mobility Management Entity (MME) and an Access and Mobility Management Function (AMF), which are not limited in this application embodiment.

[0047] In this context, terminal equipment can also be referred to as user equipment (UE), access terminal, user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication equipment, user agent, or user device, etc. Terminal equipment can be a station (STAION, ST) in a WLAN, a cellular phone, cordless phone, Session Initiation Protocol (SIP) phone, Wireless Local Loop (WLL) station, Personal Digital Assistant (PDA) device, handheld device with wireless communication capabilities, computing device or other processing device connected to a wireless modem, in-vehicle equipment, wearable device, terminal equipment in next-generation communication systems such as NR networks, or terminal equipment in future evolved Public Land Mobile Network (PLMN) networks, etc.

[0048] In this application embodiment, the terminal device can be deployed on land, including indoors or outdoors, handheld, wearable, or vehicle-mounted; it can also be deployed on water (such as ships); and it can also be deployed in the air (e.g., on airplanes, balloons, and satellites). In this application embodiment, the terminal device can be a mobile phone, tablet computer, computer with wireless transceiver capabilities, virtual reality (VR) terminal device, augmented reality (AR) terminal device, wireless terminal device in industrial control, wireless terminal device in self-driving, wireless terminal device in remote medical care, wireless terminal device in smart grid, wireless terminal device in transportation safety, wireless terminal device in smart city, or wireless terminal device in smart home, etc.

[0049] By way of example and not limitation, in this embodiment, the terminal device can also be a wearable device. Wearable devices, also known as wearable smart devices, are a general term for devices that utilize wearable technology to intelligently design and develop everyday wearables, such as glasses, gloves, watches, clothing, and shoes. Wearable devices are portable devices that are worn directly on the body or integrated into the user's clothing or accessories. Wearable devices are not merely hardware devices, but also achieve powerful functions through software support, data interaction, and cloud interaction. Broadly speaking, wearable smart devices include those that are feature-rich, large in size, and can achieve complete or partial functions without relying on a smartphone, such as smartwatches or smart glasses, as well as those that focus on a specific type of application function and require the use of other devices such as smartphones, such as various smart bracelets and smart jewelry for vital sign monitoring.

[0050] Network equipment can be further divided into access network equipment and core network equipment. That is, the wireless communication system also includes multiple core networks used to communicate with the access network equipment. Access network equipment can be evolved Node Bs (eNBs or e-NodeBs) in Long-Term Evolution (LTE), Next-Generation Radio (NR) (mobile communication system), or Authorized Auxiliary Access Long-Term Evolution (LAA-LTE) systems, such as macro base stations, micro base stations (also called "small base stations"), pico base stations, access points (APs), transmission points (TPs), or new generation Node Bs (gNodeBs).

[0051] In the embodiments of this application, the network device can be a device for communicating with mobile devices. The network device can be an access point (AP) in WLAN, a base station (BTS) in GSM or CDMA, a base station (NodeB, NB) in WCDMA, an evolved base station (eNB or eNodeB) in LTE, a relay station or access point, or a vehicle-mounted device, wearable device, or a network device (gNB) in an NR network, or a network device in a future evolved PLMN network or an NTN network, etc.

[0052] By way of example and not limitation, in this embodiment, the network device may have mobility characteristics; for example, the network device may be a mobile device. Optionally, the network device may be a satellite or a balloon station. For example, the satellite may be a low Earth orbit (LEO) satellite, a medium Earth orbit (MEO) satellite, a geostationary earth orbit (GEO) satellite, a high elliptical orbit (HEO) satellite, etc. Optionally, the network device may also be a base station located on land, water, or other similar locations.

[0053] In this embodiment, the network device can provide services to a cell. The terminal device communicates with the network device through the transmission resources (e.g., frequency domain resources, or spectrum resources) used by the cell. The cell can be the cell corresponding to the network device (e.g., a base station). The cell can belong to a macro base station or to a base station corresponding to a small cell. The small cell can include: metro cell, micro cell, pico cell, femto cell, etc. These small cells have the characteristics of small coverage area and low transmission power, and are suitable for providing high-speed data transmission services.

[0054] It should be understood that devices with communication functions in the network / system of this application embodiment can be referred to as communication devices. Figure 1 Taking the communication system shown as an example, the communication equipment may include network devices and terminal devices with communication functions. The network devices and terminal devices may be specific devices in the embodiments of this application, which will not be described in detail here. The communication equipment may also include other devices in the communication system, such as network controllers, mobility management entities and other network entities, which are not limited in the embodiments of this application.

[0055] To facilitate understanding of the embodiments of this application, the basic processes and concepts involved in the embodiments of this application are briefly described below. It should be understood that the basic processes and concepts described below do not limit the embodiments of this application.

[0056] In the 5G network system architecture diagram as follows Figure 2As shown, these include: NSSF (Network Slice Selection Function), primarily used for managing network slice-related information, such as selecting network slices for terminal devices; AUSF (Authentication Server Function), used for user access authentication; UDM (Unified Data Management), used for managing and storing subscription data and authentication data; AMF (Access and Mobility Management Function), used for mobility management, security anchors, and security context management, etc. In addition to managing UE mobility, the AMF is also responsible for forwarding session management-related messages between the UE and SMF; SMF (Session Management Function), used for session management, UE IP address allocation and management, etc.; PCF (Policy Control Function), responsible for formulating policies related to UE mobility management, session management, and billing; AF (Application Function), used for external application servers; and UPF (User Plane Function), used for complex user plane processing, such as forwarding traffic between the radio access network and the internet, reporting traffic usage, and QoS (Quality of Service). Quality of Service (QoS) strategy implementation, etc.; DN (Data Network) refers to the external data network of 5GC (such as the Internet).

[0057] In addition, data transmission occurs between various nodes of the 5GC (5G core network), between user equipment (UE) and 5GC nodes, between UE and the Radio Access Network (RAN), and between the RAN and 5GC nodes, respectively, through corresponding interfaces. For example... Figure 2As shown: In 5GC, the AMF and NSSF transmit data via interface N22; the AMF transmits data with the SMF via interface N11; the AMF transmits data with the AUSF via interface N12; the AMF and UDM transmit data via interface N8. The SMF and UPF transmit data via interface N4. The UPF transmits data with the external data network via interface N6 and with the AN via interface N3. The UE connects to the AN through the Uu port for access layer communication, exchanging access layer messages and radio data transmissions; the UE connects to the AMF through the N1 port for non-access layer (NAS) communication, exchanging NAS messages. The RAN and AMF transmit data via interface N2, and the RAN and UPF transmit data via interface N3. It should be understood that the above only describes the interfaces between some nodes. Figure 2 Other interfaces between other nodes of 5GC will not be described in detail.

[0058] It should be understood that the terms "system" and "network" are often used interchangeably in this document. The term "and / or" in this document merely describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Furthermore, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship.

[0059] It should be understood that the term "instruction" mentioned in the embodiments of this application can be a direct instruction, an indirect instruction, or an indication of a relationship. For example, A instructing B can mean that A directly instructs B, such as B being able to obtain information through A; it can also mean that A indirectly instructs B, such as A instructing C, so B can obtain information through C; or it can mean that there is a relationship between A and B.

[0060] In the description of the embodiments of this application, the term "correspondence" may indicate that there is a direct or indirect correspondence between two things, or that there is an association between two things, or that there is a relationship of instruction and being instructed, configuration and being configured, etc.

[0061] To facilitate understanding of the technical solutions of the embodiments of this application, the relevant technologies of the embodiments of this application are described below. The following relevant technologies are optional solutions and can be combined with the technical solutions of the embodiments of this application in any way, and they all fall within the protection scope of the embodiments of this application.

[0062] Figure 3 This is a schematic flowchart of a communication method according to an embodiment of this application. The method includes at least a portion of the following.

[0063] S310, The relay device receives a first message sent by the first device, wherein the first message is used to request a connection with the second device; S320. The relay device sends a second message to the second device, wherein the second message is used to request sharing the first connection to transmit data between the first device and the second device, or the second message is used to request establishing a second connection between the relay device and the second device to transmit data between the first device and the second device.

[0064] Figure 4 This is a schematic flowchart of a communication method according to another embodiment of this application. The method includes at least a portion of the following.

[0065] S410. The first device sends a first message to the relay device, wherein the first message is used to request a connection with the second device, and the first message is used to trigger the relay device to send a second message to the second device, wherein the second message is used to request sharing a first connection to transmit data between the first device and the second device, or the second message is used to request establishing a second connection between the relay device and the second device to transmit data between the first device and the second device.

[0066] Figure 5 This is a schematic flowchart of a communication method according to another embodiment of this application. The method includes at least a portion of the following.

[0067] S510. The second device receives a second message sent by the relay device, wherein the second message is used to request sharing the first connection to transmit data between the first device and the second device, or the second message is used to request establishing a second connection between the relay device and the second device to transmit data between the first device and the second device.

[0068] Here, the first device, relay device, and second device can all be terminal devices. The first device can also be called the first initiating device, the second device can be called the target device, and the relay device can also be called the forwarding device.

[0069] The connections mentioned in the embodiments of this application all refer to PC5 interface connections. These PC5 interface connections can be called PC5 connections, PC5 links, etc. This application does not exhaustively list all possible names for the connections in this embodiment.

[0070] In some possible implementations, the first message may be a direct communication request message.

[0071] Before the first device sends the first message to the relay device, the first device may select a relay device from multiple candidate relay devices. Whether a PC5 connection already exists between the first device and the relay device is not limited in this embodiment.

[0072] The first message is used to request a connection with the second device, and the first message is used to request a connection with the relay device. Specifically, the first message requesting a connection with the relay device may also refer to: the first message also being used to request the establishment of a fourth connection between the first device and the relay device.

[0073] Optionally, the first message may carry the identifier of the first device and the identifier of the second device. The identifier may be an application layer identifier and / or a link layer identifier, and the link layer identifier may also be called a Layer 2 identifier (L2 ID).

[0074] Optionally, in addition to carrying the identifiers of the first device and the second device, the first message may also carry information about the target service. Specifically, the information about the target service may include at least one of the following: the application identifier of the target service and the service type of the target service. In addition, the information about the target service may also include the relay service code (RSC) corresponding to the target service. This embodiment does not limit the configuration or determination method of the correspondence between the target service and the relay service code.

[0075] In some possible implementations, the relay device sending a second message to the second device includes: the relay device sending a second message to the second device when a first connection exists between the relay device and the second device and the first connection is in a state where sharing is allowed, the second message being used to request sharing the first connection to transmit data between the first device and the second device.

[0076] The relay device sends a second message to the second device, including: when there is a first connection between the relay device and the second device and the first connection is in a state where sharing is not allowed, the relay device sends a second message to the second device, wherein the second message is used to request the establishment of a second connection between the relay device and the second device to transmit data between the first device and the second device.

[0077] After the relay device receives the first message sent by the first device, the method further includes: when there is no connection between the relay device and the second device, the relay device sends a second message to the second device, the second message being used to request the establishment of a second connection between the relay device and the second device to transmit data between the first device and the second device.

[0078] In other words, the second message can have two possibilities. One is a second message requesting the sharing of the first connection to transmit data between the first device and the second device; this type of second message will be referred to below as the second message requesting the sharing of the first connection. The other is a second message requesting the establishment of a second connection between the relay device and the second device to transmit data between the first device and the second device; this type of second message will be referred to below as the second message requesting the establishment of a second connection between the relay device and the second device.

[0079] The method by which the relay device determines whether the first connection is in a state where sharing is allowed may include: the relay device determining whether the first connection is in a state where sharing is allowed based on the first state indication information of the first connection.

[0080] The following explanations will cover two scenarios: one where the first message does not carry information about the target business, and another where the first message carries information about the target business.

[0081] In one scenario, the first message does not carry information about the target business.

[0082] After receiving the first message from the first device, the relay device can first determine whether a connection exists between it and the second device. If no connection exists between the relay device and the second device, the relay device sends a second message to the second device to request the establishment of a second connection between the relay device and the second device. If a connection exists between the relay device and the second device, the relay device uses that connection as the first connection between the relay device and the second device. Based on the first status indication information of the first connection, the relay device determines whether the first connection is in a state where sharing is allowed. If the first connection is in a state where sharing is allowed, the relay device sends a second message to the second device to request sharing of the first connection. If the first connection is in a state where sharing is not allowed, the relay device sends a second message to the second device to request the establishment of a second connection between the relay device and the second device. Alternatively, if the relay device has multiple connections with the second device, it may use any one of these connections as the first connection. Based on the first status indication information of the first connection, the relay device determines whether the first connection is in a state where sharing is allowed. If the first connection is in a state where sharing is allowed, it sends a second message to the second device to request sharing the first connection. If the first connection is in a state where sharing is not allowed, and it is determined that the determination of all connections has been completed, it sends a second message to the second device to request the establishment of a second connection between the relay device and the second device. If the first connection is in a state where sharing is not allowed, and there are remaining connections that have not been determined, it selects any one of the remaining connections as a new first connection to continue the determination.

[0083] The relay device can determine whether a connection exists with the second device by: obtaining the identifier of the second device from the first message, and determining whether a connection exists between the relay device and the second device based on the identifier of the second device. Specifically, determining whether a connection exists between the relay device and the second device based on the identifier of the second device can include: the relay device determining whether a connection exists between the relay device and the second device based on the identifier of the second device and connection-related information of the relay device. The connection-related information of the relay device can include information on whether a connection exists between the relay device and each of the at least one candidate target device.

[0084] The aforementioned relay device determines whether the first connection is in a sharing-allowed state based on the first status indication information of the first connection, including one of the following: if the first status indication information of the first connection includes an indication that the first connection accepts sharing, the first connection is determined to be in a sharing-allowed state; if the first status indication information of the first connection includes a maximum number of initiating devices that can share the first connection, and the current number of initiating devices that have already shared the first connection is less than the maximum number, the first connection is determined to be in a sharing-allowed state; if the first status indication information of the first connection includes an indication that the number of initiating devices that have already shared the first connection has not reached the maximum number, the first connection is determined to be in a sharing-allowed state; if the first status indication information of the first connection includes a first remaining number of initiating devices that can share the first connection, and the first remaining number is not zero, the first connection is determined to be in a sharing-allowed state.

[0085] Alternatively, the relay device may determine whether the first connection is in a sharing-allowed state based on the first status indication information of the first connection, and may further include one of the following: if the first status indication information of the first connection includes an indication that the first connection does not accept sharing, then the first connection is determined to be in a sharing-disallowed state; if the first status indication information of the first connection includes a maximum number of initiating devices that can share the first connection, and the current number of initiating devices that have shared the first connection reaches the maximum number, then the first connection is determined to be in a sharing-disallowed state; if the first status indication information of the first connection includes an indication that the number of initiating devices that have shared the first connection has reached the maximum number, then the first connection is determined to be in a sharing-disallowed state; if the first status indication information of the first connection includes a first remaining number of initiating devices that can share the first connection, and the first remaining number is zero, then the first connection is determined to be in a sharing-disallowed state.

[0086] Here, the first status indication information of the first connection may be sent by the second device to the relay device when the relay device and the second device last established the first connection, or when the relay device and the second device last shared the first connection. The first status indication information of the first connection may include at least one of the following: an indication of whether the first connection accepts sharing; the maximum number of initiating devices that can share the first connection; an indication of whether the number of initiating devices that have shared the first connection has reached the maximum number; and a first remaining number of initiating devices that can share the first connection.

[0087] Optionally, the first status indication information of the first connection includes an indication of whether the first connection receives sharing.

[0088] The indication of whether the first connection accepts sharing can be the same for each status indication of the first connection. That is, the first connection can accept sharing even if there is no limit to the maximum number of sharing initiating devices, or the first connection cannot be shared and will not accept sharing. Whether the first connection continues to accept sharing can be determined by the second device based on configuration information or its own situation, and this embodiment does not limit it.

[0089] Alternatively, the indication of whether the first connection accepts sharing can be determined by the second device based on the actual situation each time the first connection status indication information is sent. For example, if the second device determined that the first connection cannot be shared next time when it last determined to share the first connection, it can set the indication of whether the first connection accepts sharing to not accept sharing next time when sending the previous status indication information of the first connection. Or, if the second device determined that the first connection can be shared next time when it last determined to establish the first connection, it can set the indication of whether the first connection accepts sharing to accept sharing next time when sending the previous status indication information of the first connection. The second device can determine whether to accept sharing next time based on the maximum number of devices that initiate the sharing of the first connection, or it can determine whether to accept sharing next time based on other configuration information, or it can determine whether to accept sharing next time based on its own resource allocation. This embodiment does not limit these methods. The indication of whether the first connection accepts sharing can be represented by an indication value. For example, if the indication value of whether the first connection accepts sharing is 1, it indicates that the first connection accepts sharing; if the indication value of whether the first connection accepts sharing is 0, it indicates that the first connection does not accept sharing; or vice versa. Alternatively, the indication of whether the first connection accepts sharing can be represented by an indication content. For example, if the indication content of whether the first connection accepts sharing is yes or accept or share, it indicates that the first connection accepts sharing; if the indication content of whether the first connection accepts sharing is no or does not accept or share, it indicates that the first connection does not accept sharing.

[0090] Accordingly, the relay device determines whether the first connection is in a sharing-allowed state based on the first status indication information of the first connection. This can be done as follows: if the first status indication information of the first connection includes an indication that the first connection accepts sharing, the first connection is determined to be in a sharing-allowed state; otherwise, the first connection is determined to be in a sharing-disallowed state.

[0091] Optionally, the first status indication information of the first connection includes the maximum number of initiating devices that can share the first connection.

[0092] The maximum number of initiating devices that can share the first connection can be determined by the second device based on its own configuration or circumstances, and this embodiment does not limit it. Specifically, the maximum number of initiating devices that can share the first connection can be a positive integer, such as 10, 5, 2, or more or less, and is not exhaustively listed here.

[0093] Accordingly, the relay device determines whether the first connection is in a state where sharing is allowed based on the first status indication information of the first connection. This can be achieved by: if the first status indication information of the first connection includes the maximum number of initiating devices that can share the first connection, the relay device obtains the current number of initiating devices that have already shared the first connection; and determines whether the current number of initiating devices that have already shared the first connection is less than the maximum number. If it is less, the relay device determines that the first connection is in a state where sharing is allowed; otherwise, the relay device determines that the first connection is in a state where sharing is not allowed.

[0094] Optionally, the first status indication information of the first connection includes an indication of whether the number of initiating devices that have shared the first connection has reached the maximum number.

[0095] The indication of whether the number of initiating devices that have shared the first connection has reached the maximum number can be determined by the second device based on its own configuration. For example, the processing of the second device may include: when the second device last determined to share the first connection or established the first connection, determining the number of initiating devices that had previously shared the first connection, and judging whether the number of initiating devices that had previously shared the first connection has reached the maximum number of initiating devices that the first connection can accept for sharing. If it has, then the first status indication information of the first connection includes an indication that the number of initiating devices that have shared the first connection has reached the maximum number; otherwise, the first status indication information of the first connection includes an indication that the number of initiating devices that have shared the first connection has not reached the maximum number.

[0096] The indication of whether the number of the first connected, first shared initiating devices has reached the maximum number can be represented by an indication value. For example, if the indication value is 1, it indicates that the maximum number has been reached; if the indication value is 0, it indicates that the maximum number has not been reached; or vice versa. Alternatively, the indication of whether the number of the first connected, first shared initiating devices has reached the maximum number can be represented by an indication content. For example, if the indication content is "yes" or "reached the maximum number," it indicates that the number of the first connected, first shared initiating devices has reached the maximum number; if the indication content is "no" or "not reached the maximum number," it indicates that the number of the first connected, first shared initiating devices has not reached the maximum number.

[0097] Accordingly, the relay device determines whether the first connection is in a state where sharing is allowed based on the first status indication information of the first connection. This can be done as follows: if the first status indication information of the first connection includes an indication that the number of initiating devices that have shared the first connection has not reached the maximum number, then the first connection is determined to be in a state where sharing is allowed; otherwise, the first connection is determined to be in a state where sharing is not allowed.

[0098] Optionally, the first status indication information of the first connection includes a first remaining number of initiating devices capable of sharing the first connection.

[0099] The first remaining number of initiating devices capable of sharing the first connection can be determined by the second device. For example, the processing of the second device may include: when the second device last determined to share the first connection or last determined to establish the first connection, determining the number of initiating devices that have already shared the first connection, and subtracting the number of initiating devices that have already shared the first connection from the maximum number of initiating devices capable of sharing the first connection to obtain the first remaining number of initiating devices capable of sharing the first connection.

[0100] Accordingly, the relay device determines whether the first connection is in a state where sharing is allowed based on the previous status indication information of the first connection. This can be done by: if the previous status indication information of the first connection includes a first remaining number of initiating devices that can share the first connection, determining whether the first remaining number is zero; if it is not zero, determining that the first connection is in a state where sharing is allowed; otherwise, determining that the first connection is in a state where sharing is not allowed.

[0101] It should be understood that the first status indication information of the first connection may include any one of the above four contents. Alternatively, the first status indication information of the first connection may include at least some of the above four contents. For example, the first status indication information of the first connection may include an indication of whether the first connection accepts sharing, and a first remaining number of initiating devices capable of sharing the first connection. In this case, the relay device determines whether the first connection is in a state where sharing is allowed based on the first status indication information of the first connection, which may be as follows: if the first status indication information of the first connection includes an indication of whether the first connection accepts sharing and a first remaining number of initiating devices capable of sharing the first connection, and the first status indication information of the first connection indicates that sharing is allowed, then the first connection is determined to be in a state where sharing is allowed, and the first remaining number of initiating devices capable of sharing the first connection is saved for use in the next determination of whether to share the first connection in conjunction with the second status indication information of the first connection; if the first status indication information of the first connection indicates that sharing is not allowed, then the first connection is determined to be in a state where sharing is not allowed, and the first remaining number of initiating devices capable of sharing the first connection is saved for use in the next determination of whether to share the first connection in conjunction with the second status indication information of the first connection. This is merely an illustrative example. There may be other examples of how the first state indication information of the first connection may include at least some of the above four types of content, which will not be exhaustively listed here.

[0102] After the relay device determines that the first connection is in a shareable state, the relay device can send a second message to the second device requesting to share the first connection, so as to transmit data between the first device and the second device through the first connection. Here, transmitting data between the first device and the second device through the first connection can mean that the relay device forwards data between the first device and the second device through the first connection.

[0103] The second message used to request sharing the first connection can be a link modification request message, specifically a link modification request message for the first connection. This second message can carry relevant information about the first connection, such as the first connection's number, identifier, configuration information, or at least one of these.

[0104] The second message used to request sharing the first connection may carry the identifier of the first device. Furthermore, if the first message carries the address information of the first device, the second message may also carry the address information of the first device, wherein the address information may be network address information, such as at least one of an Internet Protocol (IP) address, a Media Access Control (MAC) address, etc.

[0105] When there is no connection between the relay device and the second device, or when a first connection exists between the relay device and the second device and the first connection is in a state where sharing is not allowed, the relay device sends a second message to the second device to request the establishment of a second connection between the relay device and the second device. The type of the second message requesting the establishment of the second connection between the relay device and the second device can be a direct communication request message. This second message may carry the identifier of the first device, and further, it may also carry the address information of the first device.

[0106] In another scenario, the first message carries information about the target business.

[0107] Optionally, in this scenario, the processing performed by the relay device can be the same as in the aforementioned embodiments, that is, the relay device does not process at the target service level. In this approach, the first connection can carry the target service; or, the first connection does not carry the target service, and there is no connection carrying the target service between the relay device and the second device. Furthermore, the second message used to request sharing the first connection, or the second message used to request establishing a second connection between the relay device and the second device, may or may not carry information about the target service. The processing of the second device, the relay device, and the first device is the same as in the aforementioned embodiments and will not be described again.

[0108] Optionally, if the first message carries information about the target service, the relay device processes the data at the target service level. In this approach, the first connection carries the target service; additionally, the aforementioned second message requesting the sharing of the first connection carries the information about the target service.

[0109] When a first connection exists between the relay device and the second device, and the first connection is in a state where sharing is permitted, sending a second message to the second device may include: when a connection carrying a target service exists between the relay device and the second device, the relay device uses this connection as the first connection between the relay device and the second device; the relay device determines whether the first connection is in a state where sharing is permitted based on the first status indication information of the first connection; when the first connection is in a state where sharing is permitted, the relay device sends a second message to the second device to request sharing of the first connection, and the second message may carry information about the target service.

[0110] In addition, when the first connection is in a state where sharing is not allowed, the relay device sends a second message to the second device to request the establishment of a second connection between the relay device and the second device. This process is the same as in the previous embodiment, except that the second message for requesting the establishment of a second connection between the relay device and the second device carries information about the target service.

[0111] When the relay device sends a second message to the second device when there is no connection between the relay device and the second device, the message may include: the relay device sending a second message to the second device to request the establishment of a second connection between the relay device and the second device, the second message carrying information about the target service; or, the relay device sending a second message to the second device to request the establishment of a second connection between the relay device and the second device, the second message carrying information about the target service, when there is no connection between the relay device and the second device carrying the target service.

[0112] Specifically, after receiving the first message from the first device, the relay device can first determine whether a connection exists between itself and the second device. If no connection exists, the relay device sends a second message to the second device requesting the establishment of a second connection between itself and the second device. This second message carries information about the target service. If one or more connections exist between the relay device and the second device, it determines whether any of these connections carries the target service. If no connection exists, the relay device sends a second message to the second device requesting the establishment of a second connection between itself and the second device. This second message carries information about the target service. If a connection carrying the target service exists, this connection is designated as the first connection between the relay device and the second device. Based on the first status indication information of the first connection, the relay device determines whether the first connection is in a state where sharing is allowed. If the first connection is in a state where sharing is allowed, the relay device sends a second message to the second device. If the first connection is in a state where sharing is not allowed, the relay device sends a second message to the second device requesting the sharing of the first connection. This second message carries information about the target service.

[0113] The method by which the relay device determines whether a connection exists between itself and the second device is the same as in the previous embodiment and will not be repeated here. The relay device can determine whether a connection carrying the target service exists among the one or more connections by: obtaining information about the target service from the first message, and then determining whether a connection carrying the target service exists among the one or more connections based on the information about the target service.

[0114] The aforementioned relay device determines whether the first connection is in a sharing-allowed state based on the first status indication information of the first connection, including one of the following: If the first status indication information of the first connection includes an indication that the target service carried by the first connection accepts sharing, the first connection is determined to be in a sharing-allowed state; if the first status indication information of the first connection includes a maximum number of initiating devices capable of sharing the target service carried by the first connection, and the current number of initiating devices that have already shared the target service carried by the first connection is less than the maximum number, the first connection is determined to be in a sharing-allowed state; if the first status indication information of the first connection includes an indication that the number of initiating devices that have already shared the target service carried by the first connection has not reached the maximum number, the first connection is determined to be in a sharing-allowed state; if the first status indication information of the first connection includes a first remaining number of initiating devices capable of sharing the target service carried by the first connection, and the first remaining number is not zero, the first connection is determined to be in a sharing-allowed state.

[0115] Alternatively, the relay device may determine whether the first connection is in a sharing-allowed state based on the first status indication information of the first connection, and may further include one of the following: if the first status indication information of the first connection includes an indication that the target service carried by the first connection does not accept sharing, then the first connection is determined to be in a sharing-disallowed state; if the first status indication information of the first connection includes a maximum number of initiating devices capable of sharing the target service carried by the first connection, and the current number of initiating devices that have shared the target service carried by the first connection has reached the maximum number, then the first connection is determined to be in a sharing-disallowed state; if the first status indication information of the first connection includes an indication that the number of initiating devices that have shared the target service carried by the first connection has reached the maximum number, then the first connection is determined to be in a sharing-disallowed state; if the first status indication information of the first connection includes a first remaining number of initiating devices capable of sharing the target service carried by the first connection, and the first remaining number is zero, then the first connection is determined to be in a sharing-disallowed state.

[0116] Here, the first status indication information of the first connection may include at least one of the following: an indication of whether each service among the one or more services carried by the first connection accepts sharing; the maximum number of initiating devices capable of sharing each service among the one or more services carried by the first connection; an indication of whether the number of initiating devices that have shared each service among the one or more services carried by the first connection has reached the maximum number; and a first remaining number of initiating devices capable of sharing each service among the one or more services carried by the first connection. Wherein, the one or more services include the aforementioned target service.

[0117] It should be understood that the description of the four contents included in the first status indication information of the first connection is similar to that in the previous embodiments. The only difference is that the first status indication information of the first connection includes specific information corresponding to each service carried by the first connection. Therefore, the above information contents will not be repeated. The specific description of the relay device determining whether the first connection is in a sharing-allowed state based on the first status indication information of the first connection is also similar to that in the previous embodiments. The only difference is that the relay device determines whether the target service carried by the first connection is sharing-allowed at the granularity of the target service, and thus determines whether the first connection is sharing-allowed. This will not be repeated here.

[0118] In some possible implementations, the second message is used to request sharing the first connection to transmit data between the first device and the second device. After the second device receives the second message sent by the relay device, the method The law also includes: The second device sends a response message to the relay device for the second message, wherein the response message for the second message is used to indicate whether the second device agrees to share the first connection, and the response message for the second message carries second status indication information of the first connection, which is used by the relay device to determine whether the first connection is in a state that allows sharing in the next time.

[0119] The second device sends a response message to the relay device for the second message, including one of the following: if the second device determines to share the first connection, it sends a response message to the relay device indicating that the second device agrees to share the first connection; if the second device determines not to share the first connection, it sends a response message to the relay device indicating that the second device refuses to share the first connection. That is, regardless of whether the second device determines to share the first connection or refuses to share the first connection, it will carry the second status indication information of the first connection in the response message for the second message.

[0120] As described in the foregoing embodiments, the second message can be a link modification request message for the first connection. Correspondingly, when the response message of the second message is used to indicate that the second device agrees to share the first connection, the response message of the second message can specifically be a link modification acceptance message for the first connection. When the response message of the second message is used to indicate that the second device refuses to share the first connection, the response message of the second message can specifically be a link modification rejection message for the first connection.

[0121] The following explanations will cover two scenarios: one in which the second message used to request sharing the first connection does not carry information about the target service, and another in which the second message used to request sharing the first connection carries information about the target service.

[0122] In one scenario, the second message used to request sharing the first connection does not carry information about the target business.

[0123] The second status indication information of the first connection includes at least one of the following: an indication of whether the first connection accepts sharing; the maximum number of initiating devices that can share the first connection; an indication of whether the number of initiating devices that have shared the first connection has reached the maximum number; and a third remaining number of initiating devices that can share the first connection. A detailed description of the four contents included in the second status indication information of the first connection is consistent with the foregoing embodiments. Place Narrative The detailed description of the first state indication information of the first connection is similar, so it will not be repeated here.

[0124] Before sending the response message to the second message, the second device will also determine whether to share the first connection and obtain the second status indication information of the first connection. The processing method for the second device to determine whether to share the first connection and obtain the second status indication information of the first connection may include: the second device obtaining the relevant status information of the first connection based on the identifier of the first connection carried in the second message; determining whether the first connection is in a shareable state based on the relevant status information of the first connection; if the first connection is in a non-shareable state, determining not to share the first connection, and generating the second status indication information of the first connection based on the relevant status information of the first connection; if the first connection is in a shareable state, determining to share the first connection, and generating the second status indication information of the first connection based on the relevant status information of the first connection. It should be understood that the method by which the second device determines whether to share the first connection is only an example. In actual processing, the second device may also determine whether to share the first connection based on its remaining processing resources, the total number of connection-initiating devices, etc., which will not be elaborated here.

[0125] The relevant status information of the first connection can be the relevant status information of the first connection that is updated in real time by the second device.

[0126] Optionally, the relevant status information of the first connection may include whether the first connection remains allowed to be shared. Determining whether the first connection is in a shareable state based on the relevant status information of the first connection may include: determining that the first connection is in a shareable state if the relevant status information of the first connection indicates that the first connection remains allowed to be shared; and determining that the first connection is in a non-shareable state if the relevant status information of the first connection indicates that the first connection remains non-shareable.

[0127] Furthermore, if the first connection is in a state where it cannot be shared, then it is determined that the first connection will not be shared, and a second status indication information for the first connection is generated based on the relevant status information of the first connection. This may include: if the first connection is in a state where it cannot be shared, then it is determined that the first connection will not be shared, and a second status indication information for the first connection is generated that includes an indication that the first connection does not accept sharing. If the first connection is in a state where it can be shared, then it is determined that the first connection will be shared, and a second status indication information for the first connection is generated based on the relevant status information of the first connection. This may include: if the first connection is in a state where it can be shared, then it is determined that the first connection will be shared, and a second status indication information for the first connection is generated that includes an indication that the first connection accepts sharing.

[0128] Optionally, the relevant status information of the first connection may include the maximum number of initiating devices that the first connection can accept for sharing, and the number of initiating devices that the first connection has currently shared with. Correspondingly, determining whether the first connection is in a shareable state based on the relevant status information of the first connection may include: if the relevant status information of the first connection is the maximum number of initiating devices that the first connection can accept for sharing, obtaining the number of initiating devices that the first connection has currently shared with from the relevant status information of the first connection; if the number of currently shared initiating devices is less than the maximum number, determining that the first connection is in a shareable state; otherwise, determining that the first connection is in a non-shareable state.

[0129] Furthermore, if the first connection is in a state where it cannot be shared, then it is determined that the first connection will not be shared, and a second status indication information for the first connection is generated based on the relevant status information of the first connection. This may include: if the first connection is in a state where it cannot be shared, then it is determined that the first connection will not be shared, and a second status indication information for the first connection is generated including at least one of the following: an indication that the first connection does not accept sharing; a maximum number of initiating devices that can share the first connection; an indication that the number of initiating devices that have shared the first connection has reached the maximum number; a third remaining number of initiating devices that can share the first connection; and the third remaining number is zero. If the first connection is in a state where it can be shared, then it is determined that the first connection will be shared, and a second status indication information for the first connection is generated based on the relevant status information of the first connection. This may include: if the first connection is in a state where it can be shared, then it is determined that the first connection will be shared, and a second status indication information for the first connection is generated including at least one of the following: an indication that the first connection accepts sharing; a maximum number of initiating devices that can share the first connection; an indication that the number of initiating devices that have shared the first connection has not reached the maximum number; a third remaining number of initiating devices that can share the first connection; and the third remaining number is not zero.

[0130] In another scenario, the second message used to request sharing the first connection carries information about the target business.

[0131] In one possible example, the first connection described above carries the target service.

[0132] The second status indication information of the first connection includes at least one of the following: an indication of whether the target service carried by the first connection accepts sharing; the maximum number of initiating devices capable of sharing the target service carried by the first connection; an indication of whether the number of initiating devices that have shared the target service carried by the first connection has reached the maximum number; and a third remaining number of initiating devices capable of sharing the target service carried by the first connection. A detailed description of the four contents included in the second status indication information of the first connection is provided in the foregoing embodiments. The The detailed description of the first state indication information of the first connection is similar, so it will not be repeated here.

[0133] It should be understood that the first connection may carry one or more services, which may include the target service. Therefore, the second status indication information of the first connection specifically includes at least one of the following: an indication of whether each service carried by the first connection will be shared next; the maximum number of initiating devices that can share each service carried by the first connection; an indication of whether the number of initiating devices that have shared each service carried by the first connection has reached the maximum number; and a third remaining number of initiating devices that can share each service carried by the first connection.

[0134] Before sending the response message to the second message, the second device will also determine whether to share the first connection and obtain the second status indication information of the first connection. The processing method for the second device to determine whether to share the first connection and obtain the second status indication information of the first connection may include: the second device, based on the identifier of the first connection and the information of the target service carried in the second message, obtains the relevant status information of the target service carried by the first connection; based on the relevant status information of the target service carried by the first connection, determines whether the target service carried by the first connection is in a shareable state; if the target service carried by the first connection is in a non-shareable state, it determines not to share the first connection and generates the second status indication information of the first connection based on the relevant status information of the target service carried by the first connection; if the target service carried by the first connection is in a shareable state, it determines to share the first connection and generates the second status indication information of the first connection based on the relevant status information of the first connection.

[0135] Optionally, the relevant status information of the target service carried by the first connection may include whether the target service carried by the first connection remains allowed to be shared. The step of determining whether the target service carried by the first connection is in a shareable state based on the relevant status information of the target service carried by the first connection may include: determining that the target service carried by the first connection is in a shareable state if the relevant status information of the target service carried by the first connection indicates that the target service carried by the first connection remains allowed to be shared; and determining that the target service carried by the first connection is in a non-shareable state if the relevant status information of the target service carried by the first connection indicates that the target service carried by the first connection remains non-shareable.

[0136] Furthermore, if the target service carried by the first connection is in a state where it cannot be shared, then it is determined that the first connection will not be shared, and a second status indication information for the first connection is generated based on the relevant status information of the target service carried by the first connection. This may include: if the target service carried by the first connection is in a state where it cannot be shared, then it is determined that the first connection will not be shared, and a second status indication information for the first connection is generated that includes an indication that the target service carried by the first connection does not accept sharing. If the target service carried by the first connection is in a state where it can be shared, then it is determined that the first connection will be shared, and a second status indication information for the first connection is generated based on the relevant status information of the target service carried by the first connection. This may include: if the target service carried by the first connection is in a state where it can be shared, then it is determined that the first connection will be shared, and a second status indication information for the first connection is generated that includes an indication that the target service carried by the first connection accepts sharing.

[0137] Optionally, the relevant status information of the target service carried by the first connection may include the maximum number of initiating devices that the target service of the first connection can accept for sharing, and the number of initiating devices that the target service of the first connection has currently shared with. Correspondingly, determining whether the target service of the first connection is in a shareable state based on the relevant status information of the target service of the first connection may include: if the relevant status information of the target service of the first connection is the maximum number of initiating devices that the target service of the first connection can accept for sharing, obtaining the number of initiating devices that the target service of the first connection is currently shared with in the relevant status information of the target service of the first connection; if the number of currently shared initiating devices is less than the maximum number, determining that the target service of the first connection is in a shareable state; otherwise, determining that the target service of the first connection is in a non-shareable state.

[0138] Furthermore, if the target service carried by the first connection is in a state where it cannot be shared, then it is determined that the first connection will not be shared, and a second status indication information for the first connection is generated based on the relevant status information of the target service carried by the first connection. This may include: if the target service carried by the first connection is in a state where it cannot be shared, then it is determined that the first connection will not be shared, and a second status indication information for the first connection is generated including at least one of the following: an indication that the target service carried by the first connection does not accept sharing; the maximum number of initiating devices that can share the target service carried by the first connection; an indication that the number of initiating devices that have shared the target service carried by the first connection has reached the maximum number; a third remaining number of initiating devices that can share the target service carried by the first connection, and the third remaining number is zero. If the target service carried by the first connection is in a shareable state, it is determined that the first connection should be shared, and a second status indication information for the first connection is generated based on the relevant status information of the target service carried by the first connection. This may include: if the target service carried by the first connection is in a shareable state, it is determined that the first connection should be shared, and a second status indication information for the first connection is generated including at least one of the following: an indication that the target service carried by the first connection does not accept sharing; the maximum number of initiating devices that can share the target service carried by the first connection; an indication that the number of initiating devices that have shared the target service carried by the first connection has reached the maximum number; a third remaining number of initiating devices that can share the target service carried by the first connection, and the third remaining number is not zero.

[0139] In one possible example, the first connection does not carry the target service, and there is no connection between the relay device and the second device carrying the target service.

[0140] If the second device determines that it will share the first connection, it sends a response message to the relay device confirming the sharing of the first connection. This includes: if the second device determines that it will share the first connection and adds the target service to the first connection, it sends a response message to the relay device indicating that it agrees to share the first connection. In other words, in this example, there is a unique first connection between the relay device and the second device that is in a shared state, but this first connection does not carry the target service. Therefore, the second device can add configuration information related to the target service to the first connection based on the target service information carried in the second message to add the target service. If adding the target service is successful, the second device sends a response message to the relay device confirming the sharing of the first connection.

[0141] Additionally, it may include: if the second device determines that it will not share the first connection, or that it cannot add the target service to the first connection, then it sends a response message to the relay device, indicating that the second device refuses to share the first connection. Furthermore, in this case, one or more services in the second status indication information of the first connection do not include the target service.

[0142] The method by which the second device determines whether to share the first connection can be the same as the method used in the previous embodiments, which uses the relevant status information of the first connection, and will not be repeated here. This embodiment does not limit the reasons why the second device cannot increase its capacity to carry the target service.

[0143] In some possible implementations, the second message is used to request sharing the first connection to transmit data between the first device and the second device. After the relay device sends the second message to the second device, the method further includes: the relay device receiving a response message to the second message sent by the second device, wherein the response message to the second message is used to indicate whether the second device agrees to share the first connection, and the response message to the second message carries second status indication information of the first connection, the second status indication information of the first connection being used by the relay device to determine whether the first connection is in a state where sharing is allowed in the next iteration.

[0144] The method by which the relay device determines whether the first connection is in a state of being allowed to be shared based on the second status indication information of the first connection is the same as the method by which the relay device determines whether the first connection is in a state of being allowed to be shared based on the first status indication information of the first connection in the aforementioned embodiment, and will not be repeated here.

[0145] In one scenario, the aforementioned second message used to request sharing the first connection does not carry information about the target service.

[0146] Optionally, the first message is further configured to request the establishment of a fourth connection between the first device and the relay device; after the relay device receives the response message of the second message sent by the second device, the method further includes: the relay device sending a connection confirmation response to the first device when the response message of the second message indicates that the second device agrees to share the first connection and completes the establishment of the fourth connection.

[0147] Accordingly, after the first device sends the first message to the relay device, the method further includes: upon receiving a connection confirmation response sent by the relay device, the first device determines to establish the fourth connection and determines that the first device and the second device have completed the connection.

[0148] Specifically, when the relay device sends a connection confirmation response to the first device in response to the second message indicating that the second device agrees to share the first connection and the fourth connection has been established, this may include: the relay device and the first device engaging in secure information exchange; and after completing the secure information exchange and determining that the fourth connection has been established, the relay device sending a connection confirmation response to the first device. This connection confirmation response may carry the address information of the second device, which may be network address information, such as an Internet Protocol (IP) address, a Media Access Control (MAC) address, etc., at least one of these. The address information of the second device may be obtained by the relay device from the context of the first connection stored locally; or, the address information of the second device may be carried in the aforementioned response message to the second message.

[0149] The secure information exchange process between the relay device and the first device may further include: if the first message carries the address information of the first device, the relay device performs secure information exchange with the first device based on the address information of the first device; or, if the first message does not carry the address information of the first device, the relay device obtains the address information of the first device, and then performs secure information exchange with the first device based on the address information of the first device. It should be noted that before the first device and the relay device establish the fourth connection, the direct communication request message transmitted between the first device and the relay device is a signaling message, which only requires the identifier of the first device; however, establishing the fourth connection between the first device and the relay device requires further establishment of a secure connection, therefore the address information of the first device is required. This embodiment does not limit the specific processing of the secure information exchange between the first device and the relay device until the establishment of the fourth connection.

[0150] Optionally, after the relay device receives the response message of the second message sent by the second device, the method further includes: if the response message of the second message indicates that the second device refuses to share the first connection, the relay device resends a second message to the second device to request the establishment of a second connection between the relay device and the second device.

[0151] Alternatively, after the relay device receives the response message of the second message sent by the second device, the method further includes: if the response message of the second message indicates that the second device refuses to share the first connection, the relay device determines whether there are other connections between it and the second device besides the first connection. If no other connection exists, the relay device resends a second message to the second device requesting the establishment of a second connection between the relay device and the second device. If one or more other connections exist, one of the other connections is selected as a fifth connection. If the fifth connection is in a state where sharing is allowed, a third message is sent to the second device requesting the sharing of the fifth connection to forward data between the first device and the second device through the fifth connection. Alternatively, the method may include: if the fifth connection is in a state where sharing is not allowed, a second message may be sent to the second device requesting the establishment of a second connection between the relay device and the second device. Alternatively, the method may include: if the fifth connection is in a state where sharing is not allowed, and there are still other remaining connections, one of the remaining connections may be selected as the fifth connection, and the determination may be repeated; if there are no other remaining connections, a second message is sent to the second device requesting the establishment of a second connection between the relay device and the second device.

[0152] In this case, the generation method of the aforementioned third message is similar to that of the aforementioned first message, except that the first connection corresponding to the first message is replaced with the fifth connection. Furthermore, the method for determining whether the fifth connection is in a shared-allowed state is the same as the method for determining whether the first connection is in a shared-allowed state, and will not be repeated. The processing of the second device after receiving the third message from the relay device is similar to the processing of the second device after receiving the second message from the relay device, and will not be repeated. The possible content of the response message to the third message sent by the second device is also similar to the response message to the second message, except that the first connection is replaced with the fifth connection, and will not be elaborated upon. The processing of the relay device after receiving the response message to the third message sent by the second device is also similar to the processing of the relay device after receiving the response message to the second message sent by the second device, and will not be elaborated upon.

[0153] In another scenario, the aforementioned second message used to request sharing the first connection carries information about the target service.

[0154] After the relay device receives the response message of the second message sent by the second device, if the response message of the second message is used to indicate that the second device agrees to share the first connection, then the processing of the relay device and the processing of the first device are the same as in the previous embodiment. The only difference is that the first connection carries the target service, so it will not be described again.

[0155] If the relay device responds to the second message instructing the second device to refuse to share the first connection, the relay device resends a second message to the second device to request the establishment of a second connection between the relay device and the second device. This second message carrying information about the target service carries information about the target service.

[0156] In some possible implementations, the second message is used to request the establishment of a second connection between the relay device and the second device to transmit data between the first device and the second device. After the second device receives the second message sent by the relay device, the method further includes: the second device sending a response message of the second message to the relay device, the response message of the second message indicating whether the second device and the relay device have completed the establishment of the second connection.

[0157] In one scenario, the second message used to request the establishment of a second connection between the relay device and the second device does not carry information about the target service.

[0158] The processing of the response message from the second device to the relay device for sending the second message may include: the second device engaging in secure information exchange with the relay device; and, if, after the second device and the relay device determine that the establishment of the second connection has been completed, the second device sending a response message to the relay device indicative of the completion of the establishment of the second connection, wherein the response message may carry the address information of the second device. It should be understood that, if the second device determines that the second connection cannot be established, it may send a response message to the relay device indicating that the establishment of the second connection has failed.

[0159] In this context, the response message of the second message, used to indicate that the second device and the relay device have successfully established the second connection, carries status indication information for the second connection. This status indication information is used by the relay device to determine whether the second connection is in a shareable state in the next iteration. The content and generation method of this second connection status indication information are similar to those of the second status indication information for the first connection, and will not be elaborated upon further.

[0160] After the relay device sends the second message to the second device, the method further includes: the relay device receiving a response message to the second message sent by the second device, wherein the response message to the second message is used to indicate whether the second device and the relay device have completed establishing the second connection.

[0161] The first message is also used to request the establishment of a fourth connection between the first device and the relay device. After the relay device receives the response message of the second message sent by the second device, the method further includes: if the response message of the second message indicates that the second device and the relay device have completed the establishment of the second connection and the fourth connection, the relay device sends a connection confirmation response to the first device.

[0162] Here, when the relay device sends a connection confirmation response to the first device after the response message of the second message indicates that the second device and the relay device have completed establishing the second connection and the fourth connection, the relay device may send a connection confirmation response to the first device. This may include: when the response message of the second message indicates that the second device and the relay device have completed establishing the second connection, the relay device and the first device perform secure information exchange; after completing the secure information exchange, the relay device determines that the fourth connection has been established and then sends a connection confirmation response to the first device. The relevant description of this connection confirmation response is the same as in the previous embodiments and will not be repeated.

[0163] After the first device sends the first message to the relay device, the method further includes: upon receiving a connection confirmation response sent by the relay device, the first device determines to establish the fourth connection and determines that the first device and the second device have completed the connection.

[0164] In one scenario, the second message used to request the establishment of a second connection between the relay device and the second device carries information about the target service.

[0165] The processing of the second device may include: the second device receiving a second message sent by the relay device, the second message being used to request the establishment of a second connection between the relay device and the second device, the second connection being used to transmit data between the first device and the second device; specifically, the second message being used to request the establishment of a second connection between the relay device and the second device carrying the target service. After the second device receives the second message sent by the relay device, the method further includes: the second device sending a response message of the second message to the relay device, the response message of the second message being used to indicate whether the establishment of the second connection between the relay device and the second device carrying the target service has been completed.

[0166] The method by which the second device establishes the second connection carrying the target service may include: the second device engaging in secure information exchange with the relay device; and, after the secure information exchange, establishing the second connection carrying the target service based on the information of the target service. Furthermore, upon determining that the establishment of the second connection is complete, a response message indicating the completion of the establishment of the second connection carrying the target service is sent to the relay device. This response message may carry the address information of the second device. It should be understood that if the second device determines that it cannot establish the second connection, it may send a response message indicating that the establishment of the second connection has failed to reach the relay device.

[0167] In this context, the response message of the second message, used to indicate the completion of establishing a second connection carrying the target service, carries status indication information for the second connection. This status indication information is used by the relay device to determine whether the second connection is in a share-allowed state in the next iteration. The content and generation method of this second connection status indication information are similar to those of the second status indication information for the first connection, and will not be elaborated upon further.

[0168] The processing of the relay device after receiving the response message of the second message sent by the second device is the same as in the previous embodiment, and will not be described again.

[0169] The following is combined Figure 6A Taking the aforementioned first device as the first initiating UE, the relay device as the relay UE, the second device as the target UE, and the aforementioned connection specifically as a PC5 connection as an example, the above communication method is illustrated by way of example, specifically including: Step 61101: The first initiating UE sends a first message to the relay UE, the first message carrying the identifier of the first initiating UE and the identifier of the target UE. The type of the first message can be a direct communication request message. Optionally, the first message can also carry information about the target service. Optionally, the first message can also carry the address information of the first initiating UE.

[0170] Step 61102: The relay UE determines whether there is a PC5 connection between it and the target UE. If there is a first PC5 connection between the relay UE and the target UE, then proceed to step 61103. If there is no PC5 connection, then proceed to step 61108.

[0171] Step 61103: The relay UE determines whether the first PC5 connection is in a state where sharing is allowed based on the first connection status information of the first PC5 connection. If the first PC5 connection is in a state where sharing is allowed, then step 61104 is executed; otherwise, step 61108 is executed.

[0172] Step 61104: The relay UE sends a second message to the target UE, the second message being used to request sharing the first PC5 connection.

[0173] Specifically, the second message may be a link modification request message for the first PC5 connection.

[0174] Step 61105: The target UE determines whether to share the first PC5 connection. If it determines to share the first PC5 connection, then proceed to step 61106; otherwise, proceed to step 61107.

[0175] Step 61106: The target UE sends a response message to the relay UE to confirm the second message used to share the first PC5 connection, and then executes step 6110.

[0176] The response message used to confirm the sharing of the second message of the first connection can specifically be a link modification acceptance message for the first PC5 connection.

[0177] Step 61107: The target UE sends a response message to the relay UE for refusing to share the first PC5 connection. Specifically, this response message for refusing to share the first PC5 connection may be a link modification rejection message for the first PC5 connection.

[0178] Step 61108: The relay UE sends a second message to the target UE. The second message requests the establishment of a second PC5 connection between the relay device and the second device. The second PC5 connection is used to transmit data between the first device and the second device. The type of this second message can be a direct communication request message.

[0179] Step 61109: If the target UE and the relay UE have successfully established the second PC5 connection, the target UE sends a response message to the relay UE confirming the successful establishment of the second PC5 connection. This response message confirming the successful establishment of the second PC5 connection can be the direct communication acceptance message corresponding to the second message.

[0180] Step 6110: The relay UE and the first initiating UE exchange security information.

[0181] Step 6111: The relay UE sends a connection confirmation response to the first initiating UE, ending the process. This connection confirmation response can be the direct communication acceptance message corresponding to the first message.

[0182] The first message mentioned above can carry information about the target service, the second message can carry information about the target service, and the third message can carry information about the target service. Regarding the case where the message carries information about the target service, the specific processing of the above steps is the same as in the previous embodiment, so it will not be described again.

[0183] Through the above example, the relay UE can decide whether to send a second message, namely a link modification request message for the first PC5 connection, to the target UE based on whether the first PC5 connection allows sharing. This allows the first PC5 connection between the relay UE and the target UE to serve multiple initiating UEs, while avoiding the resource and time waste caused by the relay UE sending a link modification request message without proper judgment, resulting in a refusal to share response and the need for the relay UE to re-establish the link with the target UE.

[0184] The following is combined Figure 6B Taking the aforementioned first device as the initiating UE, the relay device as the relay terminal, the second device as the target UE, the aforementioned first message as a direct communication request, the second message as a first request, the response message of the second message as a first response, the connection confirmation response as a direct communication acceptance, and the aforementioned connection specifically as a PC5 connection as an example, the above communication method is illustrated by way of example, specifically including: Step 6201: The initiating UE sends a direct communication request message to the relay terminal. The direct communication request message includes the identifier of the initiating UE, the identifier of the target UE, and optionally service information and the address information of the initiating UE. In this embodiment, the UE identifier can be the UE's application layer identifier and / or link layer identifier (Layer 2 ID), the service information can be the application identifier, service type, relay service code, etc., and the address information can be, for example, IP address, MAC address, etc.

[0185] Step 6202: If the relay terminal determines that there is no PC5 connection between the relay UE and the target UE or no PC5 connection for the corresponding service, then the first request is a direct communication request message, which includes the identifier of the initiating UE and optionally includes the address information of the initiating UE.

[0186] If a PC5 connection already exists or a PC5 connection corresponding to the service exists, the relay terminal sends a first request to the target UE, which is a link modification request message for the existing PC5 connection, requesting the use of the existing PC5 connection to transmit data between the initiating UE and the target UE. This message includes the identifier of the initiating UE and optionally includes the address information of the initiating UE.

[0187] Step 6203: The target UE and the relay terminal exchange secure information. This step can be performed if the first request is a direct communication request message.

[0188] Step 6204: The target UE sends the first response to the relay terminal.

[0189] Specifically, if the first request is a direct communication request message, the target UE replies to the relay terminal with a first response, which is a direct communication acceptance message. This direct communication acceptance message may optionally include the target UE's address information and carries the maximum number of initiating UEs acceptable for the connection; or whether link sharing is accepted. The relay terminal determines whether the next first request message sent to the target UE is a link modification request message or a direct communication request message based on the maximum number of initiating UEs acceptable for the connection. If the indication carried is acceptance of link sharing, the next first request message sent by the relay terminal is a link modification request message; otherwise, it is a direct communication request message. If the indication carried is that the current link can accept the maximum number of initiating UEs, the relay terminal can calculate the maximum number of initiating UEs supported by the current link and then determine whether the first request sent is a link modification request message or a direct communication request message based on this maximum number.

[0190] The target UE determines to reuse the existing PC5 connection through the first response. The first response (message) could be, for example, a link modification acceptance message for the existing PC5 connection, optionally including the target UE's address information. This step also carries the maximum number of initiating UEs acceptable for the connection; or whether to continue accepting link sharing; or whether the current link has reached its maximum acceptable number of initiating UEs. Based on the maximum acceptable number of initiating UEs for the connection, the relay terminal determines whether the next first request message sent to the target UE is a link modification request message or a direct communication request message. If the indication is to continue accepting link sharing, the next first request message sent by the relay UE is a link modification request message; otherwise, it is a direct communication request message. If the indication is that the current link has reached its maximum acceptable number of initiating UEs, the relay UE can calculate the maximum acceptable number of initiating UEs for the current link. If some initiating UEs stop service and release the link, the relay UE can then continue to use the link for other initiating UEs.

[0191] Step 6205: Initiate a secure information exchange between the UE and the relay terminal. In this step, the relay terminal may also optionally obtain the address information of the initiating UE.

[0192] Step 6206: The relay terminal replies with a direct communication acceptance (message) to the initiating UE, completing the establishment of the PC5 link between the relay UE and the initiating UE. This message carries the address information of the target UE. The relay UE determines the address of the target UE, for example, by obtaining it from step 6204, or by obtaining it from the context of an existing PC5 connection between the relay UE and the target UE stored locally.

[0193] In some possible implementations, the first device may determine whether to share the connection with the relay device.

[0194] The first device sends a first message to the relay device, including: when there is a third connection between the first device and the relay device and the third connection is in a state that allows sharing, the first device sends the first message to the relay device, and the first message is also used to request sharing the third connection.

[0195] The first device sends a first message to the relay device, including: when there is a third connection between the first device and the relay device and the third connection is in a state where sharing is not allowed, the first device sends the first message to the relay device, and the first message is further used to request the establishment of a fourth connection between the first device and the relay device.

[0196] The first device sends a first message to the relay device, including: when there is no connection between the first device and the relay device, the first device sends the first message to the relay device, and the first message is further used to request the establishment of a fourth connection between the first device and the relay device.

[0197] The first device determines whether the third connection is in a state where sharing is allowed based on the first status indication information of the third connection.

[0198] In other words, in this embodiment, the first message is also used to request sharing a third connection between the first device and the relay device, or the first message is also used to request the establishment of a fourth connection between the first device and the relay device.

[0199] The first message may carry the identifier of the first device and the identifier of the second device. Alternatively, in addition to carrying the identifiers of the first device and the second device, the first message may also carry information about the target service.

[0200] The following explanations will cover two scenarios: one where the first message does not carry information about the target business, and another where the first message carries information about the target business.

[0201] In one scenario, the first message does not carry information about the target business.

[0202] Before sending the first message to the relay device, the first device may first determine whether there is a connection between it and the relay device. If there is no connection between the first device and the relay device, the first device sends a first message to the relay device to request the establishment of a fourth connection between the first device and the relay device.

[0203] Alternatively, before sending the first message to the relay device, the first device can first determine whether a connection exists between it and the relay device. If a connection exists between the first device and the relay device, this connection is designated as the third connection between the first device and the relay device. Based on the first status indication information of the third connection, the first device determines whether the third connection is in a state where sharing is allowed. If the third connection is in a state where sharing is allowed, the first device sends a first message to the relay device requesting to share the third connection. If the third connection is in a state where sharing is not allowed, the first device sends a first message to the relay device requesting to establish a fourth connection between the first device and the relay device.

[0204] Alternatively, before sending the first message to the relay device, the first device can first determine whether a connection exists between it and the relay device. If multiple connections exist between the first device and the relay device, any one of the multiple connections can be used as the third connection. Based on the first status indication information of the third connection, the first device determines whether the third connection is in a state where sharing is allowed. If the third connection is in a state where sharing is allowed, the first device sends a first message to the relay device to request sharing the third connection. If the third connection is in a state where sharing is not allowed, and it is determined that the determination of all connections has been completed, the first device sends a first message to the relay device to request the establishment of a fourth connection between the first device and the relay device. If the third connection is in a state where sharing is not allowed, and there are remaining connections that have not been determined, any one of the remaining connections can be reselected as a new third connection to continue the determination.

[0205] The method for determining whether a connection exists between the first device and the relay device can be obtained by the first device from the status information between the candidate relay devices stored in its own memory. This embodiment does not limit this method.

[0206] The first device determines whether the third connection is in a sharing-allowed state based on the first status indication information of the third connection, including one of the following: If the first device includes an indication that the third connection accepts sharing in the first status indication information of the third connection, the first device determines that the third connection is in a sharing-allowed state; if the first device includes a maximum number of target devices that can share the third connection in the first status indication information of the third connection, and the number of target devices that have already shared the third connection is less than the maximum number, the first device determines that the third connection is in a sharing-allowed state; if the first device includes an indication that the number of target devices that have already shared the third connection has not reached the maximum number, the first device determines that the third connection is in a sharing-allowed state; if the first device includes a second remaining number of target devices that can share the third connection in the first status indication information of the third connection, and the second remaining number is not zero, the first device determines that the third connection is in a sharing-allowed state. Alternatively, in the opposite case, the first device determines that the third connection is in a sharing-disallowed state, without further explanation.

[0207] Here, the first status indication information of the third connection may be sent by the relay device to the first device when the first device and the relay device last established the third connection, or when the third connection was last shared. The first status indication information of the third connection may include at least one of the following: an indication of whether the third connection accepts sharing; the maximum number of target devices that can share the third connection; an indication of whether the number of target devices that have shared the third connection has reached the maximum number; and a second remaining number of target devices that can share the third connection.

[0208] The detailed description of the four types of content included in the first status indication information of the third connection is similar to the detailed description of the first status indication information of the first connection in the previous embodiment, and therefore will not be repeated. Furthermore, the process by which the first device determines whether the third connection is in a sharing-allowed state based on each type of content is also similar to the process by which the relay device determines whether the first connection is in a sharing-allowed state based on each type of content, and will not be elaborated upon further.

[0209] After the first device determines that the third connection is in a shareable state, the first device may send the first message to the relay device. This first message requests a connection with the second device and requests to share the third connection. Sharing the third connection may mean that the relay device forwards data between the first device and the second device by sharing the third connection.

[0210] The type of the first message used to request sharing the third connection can be a link modification request message; specifically, the first message is a link modification request message for the third connection. The first message may also carry relevant information about the third connection, such as at least one of the following: the third connection number, the third connection identifier, the third connection configuration information, etc.

[0211] If the first device has no connection with the relay device, or if the third connection between the first device and the relay device is not allowed to be shared, the first device sends a first message to the relay device to request the establishment of a fourth connection between the first device and the relay device. The first message may be a direct communication request message, and may carry the identifier of the first device. Furthermore, the first message may also carry the address information of the first device.

[0212] In another scenario, the first message carries information about the target business.

[0213] Optionally, the processing performed by the first device can be the same as in the foregoing embodiments, that is, the first device does not process at the target service level. In this approach, the third connection can carry the target service; or, the third connection does not carry the target service, and there is no connection carrying the target service between the first device and the relay device.

[0214] Optionally, if the first message carries information about the target service, the first device processes the data at the target service level. In this approach, the third connection carries the target service.

[0215] When the first device has a third connection with the relay device and the third connection is in a state where sharing is permitted, the first device sending the first message to the relay device may include: when the first device has a connection carrying the target service with the relay device, the first device uses that connection as the third connection between the first device and the relay device; the first device determines whether the third connection is in a state where sharing is permitted based on the first status indication information of the third connection; when the third connection is in a state where sharing is permitted, the first device sends the first message to the relay device, the first message also being used to request sharing of the third connection, and the first message carrying information about the target service.

[0216] When the third connection is in a state where sharing is not allowed, the first device sends the first message to the relay device. The first message is also used to request the establishment of a fourth connection between the first device and the relay device. This is the same as in the previous embodiment, except that the first message carries information about the target service.

[0217] When there is no connection between the first device and the relay device, the first device sends the first message to the relay device. The first message further requests the establishment of a fourth connection between the first device and the relay device, and may include: the first device sending a first message to the relay device requesting the establishment of a fourth connection when there is no connection between the first device and the relay device; or, the first device sending a first message to the relay device requesting the establishment of a fourth connection when there is no connection carrying the target service between the first device and the relay device. Unlike the previous embodiment, when one or more connections exist between the first device and the relay device, the method adds a determination of whether one of those connections carries the target service.

[0218] The first device determines whether the third connection is in a sharing-allowed state based on the first status indication information of the third connection, including one of the following: If the first status indication information of the third connection includes an indication that the target service carried by the third connection accepts sharing, the third connection is determined to be in a sharing-allowed state; if the first status indication information of the third connection includes a maximum number of target devices capable of sharing the target service carried by the third connection, and the number of target devices that have already shared the target service carried by the third connection is less than the maximum number, the third connection is determined to be in a sharing-allowed state; if the first status indication information of the third connection includes an indication that the number of target devices that have already shared the target service carried by the third connection has not reached the maximum number, the third connection is determined to be in a sharing-allowed state; if the first status indication information of the third connection includes a second remaining number of target devices capable of sharing the target service carried by the third connection, and the second remaining number is not zero, the third connection is determined to be in a sharing-allowed state. Alternatively, in the opposite case, the third connection is determined to be in a sharing-disallowed state.

[0219] Here, the first status indication information of the third connection may include at least one of the following: an indication of whether each service in one or more services carried by the third connection accepts sharing; the maximum number of target devices capable of sharing each service in one or more services carried by the third connection; an indication of whether the number of target devices that have shared each service in one or more services carried by the third connection has reached the maximum number; and a second remaining number of target devices capable of sharing each service in one or more services carried by the third connection. Wherein, the one or more services include the aforementioned target service. It should be understood that the description of the four contents included in the first status indication information of the third connection is similar to that in the previous embodiments, and therefore, the above information will not be repeated. The specific description of the judgment processing performed by the first device is also similar to that in the previous embodiments, the only difference is that the first device judges whether the target service carried by the third connection is allowed to be shared at the target service level, and thus determines whether the third connection is allowed to be shared. This will not be repeated here.

[0220] In some possible implementations, the processing of the relay device after receiving the first message sent by the first device may be: the relay device sends a second message to the second device, wherein the second message is used to request sharing the first connection to transmit data between the first device and the second device, or the second message is used to request establishing a second connection between the relay device and the second device to transmit data between the first device and the second device.

[0221] The specific descriptions of the above processing of the relay equipment in the two scenarios—where the first message carries information about the target service and where the first message does not carry information about the target service—are the same as those in the aforementioned embodiments and will not be repeated.

[0222] In some possible implementations, the second message is used to request sharing the first connection to transmit data between the first device and the second device. After the second device receives the second message sent by the relay device, the method further includes: the second device sending a response message of the second message to the relay device, wherein the response message of the second message is used to indicate whether the second device agrees to share the first connection, and the response message of the second message carries second status indication information of the first connection, the second status indication information of the first connection being used by the relay device to determine whether the first connection is in a state that allows sharing in the next time.

[0223] The specific descriptions of the above processing of the second device in the two scenarios—where the second message carries information about the target service and where the second message does not carry information about the target service—are the same as those in the aforementioned embodiments and will not be repeated.

[0224] After the relay device sends the second message to the second device, the method further includes: the relay device receiving a response message to the second message sent by the second device, wherein the response message to the second message is used to indicate whether the second device agrees to share the first connection, and the response message to the second message carries second status indication information of the first connection, the second status indication information of the first connection being used by the relay device to determine whether the first connection is in a state that allows sharing in the next time.

[0225] The method by which the relay device determines whether the first connection is in a state of being allowed to be shared based on the second status indication information of the first connection is the same as the method by which the relay device determines whether the first connection is in a state of being allowed to be shared based on the first status indication information of the first connection in the aforementioned embodiment, and will not be repeated here.

[0226] In one scenario, the aforementioned second message used to request sharing the first connection does not carry information about the target service.

[0227] Optionally, the first message is further configured to request the establishment of a fourth connection between the first device and the relay device; after the relay device receives the response message of the second message sent by the second device, the method further includes: the relay device sending a connection confirmation response to the first device when the response message of the second message indicates that the second device agrees to share the first connection and completes the establishment of the fourth connection.

[0228] Accordingly, after the first device sends the first message to the relay device, the method further includes: upon receiving a connection confirmation response sent by the relay device, the first device determines to establish the fourth connection and determines that the first device and the second device have completed the connection.

[0229] The process by which the relay device sends a connection confirmation response to the first device when the response message of the second message indicates that the second device agrees to share the first connection and completes the establishment of the fourth connection is the same as in the previous embodiment and will not be described in detail.

[0230] Unlike the previous embodiments, in this case, the connection confirmation response carries a fourth connection status indication information, which is used by the first device to determine whether the fourth connection is in a sharing-allowed state. This fourth connection status indication information may include at least one of the following: an indication of whether the fourth connection accepts sharing, the maximum number of target devices that can share the fourth connection, an indication of whether the number of target devices that have already shared the fourth connection has reached the maximum number, and the remaining number of target devices that can share the fourth connection. The specific meaning of the content in this fourth connection status indication information is similar to the meaning of the second (or first) status indication information of the first connection in the previous embodiments, and will not be repeated here.

[0231] Optionally, the first message is further configured to request sharing a third connection between the first device and the relay device; after the relay device receives the response message of the second message sent by the second device, the method further includes: when the response message of the second message indicates that the second device agrees to share the first connection and the relay device determines to share the third connection, the relay device sends a sharing confirmation response to the first device, the sharing confirmation response carrying second status indication information of the third connection, the second status indication information of the third connection being used by the first device to determine whether the third connection is in a state that allows sharing in the next time.

[0232] Accordingly, after the first device sends the first message to the relay device, the method further includes: upon receiving a sharing confirmation response sent by the relay device, the first device determines to share the third connection and determines that the first device and the second device have completed the connection.

[0233] In this case, the sharing confirmation response carries a second status indication information for the third connection. This second status indication information is used by the first device to determine whether the third connection is in a state where sharing is permitted. The second status indication information for the third connection may include at least one of the following: an indication that the third connection accepts sharing; the maximum number of target devices that can share the third connection; an indication that the number of target devices that have already shared the third connection has reached the maximum number; and the remaining number of target devices that can share the third connection. The specific meaning of the content in the second status indication information for the third connection is similar to the specific meaning of the second (or first) status indication information for the first connection in the aforementioned embodiments, and will not be repeated here.

[0234] Optionally, the response message of the second message is used to instruct the second device to refuse to share the first connection. The processing of the relay device after receiving the response message of the second message sent by the second device is the same as in the previous embodiment, and will not be described again.

[0235] In another scenario, the aforementioned second message carries information about the target business.

[0236] After the relay device receives the response message of the second message sent by the second device, if the response message of the second message is used to indicate that the second device agrees to share the first connection, then the processing of the relay device and the processing of the first device are the same as in the previous embodiment. The only difference is that the first connection carries the target service, so it will not be described again.

[0237] When the response message of the second message indicates that the second device refuses to share the first connection, the relay device sends a second message to the second device. This second message requests the establishment of a second connection between the relay device and the second device, which is used to transmit data between the first and second devices. The difference between this second message and the previous embodiment is that this second message carries information about the target service.

[0238] In some possible implementations, the second message is used to request the establishment of a second connection between the relay device and the second device, the second connection being used to transmit data between the first device and the second device.

[0239] In one scenario, the second message used to request the establishment of a second connection between the relay device and the second device does not carry information about the target service.

[0240] After the second device receives the second message sent by the relay device, the method further includes: the second device sending a response message to the relay device for the second message, wherein the response message is used to indicate whether the second device and the relay device have successfully established the second connection. The processing of the second device described above is the same as in the previous embodiments and will not be repeated.

[0241] After the relay device sends the second message to the second device, the method further includes: the relay device receiving a response message to the second message sent by the second device, wherein the response message to the second message is used to indicate whether the second device and the relay device have completed establishing the second connection.

[0242] Optionally, the first message is further configured to request the establishment of a fourth connection between the first device and the relay device. After the relay device receives the response message of the second message sent by the second device, the method further includes: if the response message of the second message indicates that the second device and the relay device have completed the establishment of the second connection and the fourth connection, the relay device sends a connection confirmation response to the first device.

[0243] Here, the processing of the relay device and the first device is the same as in the previous embodiments, and will not be repeated. The only difference from the previous embodiments is that the connection confirmation response carries the second status indication information of the fourth connection. The second status indication information of the fourth connection is used by the first device to determine whether the fourth connection is in a state that allows sharing. The second status indication information of the fourth connection is also the same as in the previous embodiments, and will not be described again.

[0244] Optionally, the first message is further configured to request sharing a third connection between the first device and the relay device. After the relay device receives the response message of the second message sent by the second device, the method further includes: if the response message of the second message indicates that the second device and the relay device have completed establishing the second connection and the relay device has determined to share the third connection, the relay device sends a sharing confirmation response to the first device.

[0245] Here, the processing of the relay device and the first device is the same as in the previous embodiments, and will not be repeated. The only difference from the previous embodiments is that, in this case, the sharing confirmation response carries the second status indication information of the third connection. The second status indication information of the third connection is used by the first device to determine whether the third connection is in a state that allows sharing in the next instance. The second status indication information of the third connection is also the same as in the previous embodiments, and will not be described again.

[0246] In one scenario, the second message used to request the establishment of a second connection between the relay device and the second device carries information about the target service.

[0247] The processing of the second device may include: the second device receiving a second message sent by the relay device, the second message being used to request the establishment of a second connection between the relay device and the second device, the second connection being used to transmit data between the first device and the second device; specifically, the second message being used to request the establishment of a second connection between the relay device and the second device carrying the target service. After the second device receives the second message sent by the relay device, the method further includes: the second device sending a response message to the relay device for the second message, the response message being used to indicate whether the establishment of the second connection carrying the target service has been completed.

[0248] The method by which the second device establishes the second connection carrying the target service, and the response message of the second message used to indicate the completion of the process of establishing the second connection carrying the target service, are the same as in the previous embodiments, and will not be repeated here.

[0249] After the relay device sends the second message to the second device, the method further includes: the relay device receiving a response message to the second message sent by the second device, wherein the response message to the second message is used to indicate whether the establishment of the second connection carrying the target service has been completed.

[0250] The first message is also used to request the establishment of a fourth connection between the first device and the relay device, or the first message is also used to request the sharing of a third connection between the first device and the relay device. In both cases, the processing of the relay device and the first device is the same as in the foregoing embodiments, and will not be repeated.

[0251] The following is combined Figure 7A Taking the aforementioned first device as the first initiating UE, the relay device as the relay UE, the second device as the target UE, and the aforementioned connection specifically as a PC5 connection as an example, the above communication method is illustrated by way of example, specifically including: Step 7101: The first initiating UE determines whether there is a PC5 connection between itself and the relay UE. If there is a third PC5 connection between the first initiating UE and the relay UE, then proceed to step 7102. If there is no PC5 connection, then proceed to step 7104.

[0252] Step 7102: The first initiating UE determines whether the third PC5 connection is in a sharing-allowed state based on the first connection status information of the third PC5 connection. If the third PC5 connection is in a sharing-allowed state, then proceed to step 7103; otherwise, proceed to step 7104.

[0253] Step 7103: The first initiating UE sends a first message to the relay UE. This first message is used to request a connection with the second device and to request sharing the third PC5 connection. Then, the relay UE executes step 7105. The first message carries the identifier of the first initiating UE and the identifier of the target UE. The first message can be a link modification request message for the third PC5 connection. Optionally, the first message can also carry information about the target service. Optionally, the first message can also carry the address information of the first initiating UE.

[0254] Step 7104: The first initiating UE sends a first message to the relay UE. This first message is used to request a connection with the second device and to request the establishment of a fourth PC5 connection between the first initiating UE and the relay UE. The first message carries the identifier of the first initiating UE and the identifier of the target UE. This first message can be a direct communication request message. Optionally, the first message may also carry information about the target service. Optionally, the first message may also carry the address information of the first initiating UE.

[0255] Step 7105: The relay UE determines whether there is a PC5 connection between itself and the target UE. If there is a first PC5 connection between the relay UE and the target UE, then proceed to step 7106. If there is no PC5 connection, then proceed to step 7111.

[0256] Step 7106: The relay UE determines whether the first PC5 connection is in a state where sharing is allowed based on the first connection status information of the first PC5 connection. If the first PC5 connection is in a state where sharing is allowed, then proceed to step 7107; otherwise, proceed to step 7111.

[0257] Step 7107: The relay UE sends a second message to the target UE, the second message being used to request sharing the first PC5 connection. Specifically, this second message may be a link modification request message for the first PC5 connection.

[0258] Step 7108: The target UE determines whether to share the first PC5 connection. If it determines to share the first PC5 connection, then proceed to step 7109; otherwise, proceed to step 710.

[0259] Step 7109: The target UE sends a response message to the relay UE confirming the sharing of the second message of the first PC5 connection, and then the relay UE executes step 7113. Specifically, the response message confirming the sharing of the second message of the first connection can be a link modification acceptance message for the first PC5 connection.

[0260] Step 710: The target UE sends a response message to the relay UE for refusing to share the first PC5 connection, which is a second message for refusing to share the first PC5 connection. Specifically, this response message for refusing to share the first PC5 connection may be a link modification rejection message for the first PC5 connection.

[0261] Step 7111: The relay UE sends a second message to the target UE. The second message requests the establishment of a second PC5 connection between the relay device and the second device. The second PC5 connection is used to transmit data between the first device and the second device. The type of this second message can be a direct communication request message.

[0262] Step 7112: If the target UE and the relay UE have successfully established the second PC5 connection, the target UE sends a response message to the relay UE confirming the successful establishment of the second PC5 connection. This response message confirming the successful establishment of the second PC5 connection can be the direct communication acceptance message corresponding to the second message.

[0263] Step 7113: If the first request is used to request the establishment of a fourth PC5 connection between the first initiating UE and the relay UE, the relay UE sends a connection confirmation response to the first initiating UE; if the first request is used to request sharing a third PC5 connection, the relay UE sends a sharing confirmation response to the first initiating UE. The connection confirmation response can be a direct communication acceptance message corresponding to the first message, and the sharing confirmation response can be a link modification acceptance message corresponding to the first message.

[0264] The first message mentioned above can carry information about the target service, and the second message can also carry information about the target service. When the above messages carry information about the target service, the specific processing of the above steps is the same as in the previous embodiments, so it will not be described again.

[0265] Through the above example, the relay UE can decide whether to send a second message, namely a link modification request message for the first PC5 connection, to the target UE based on whether the first PC5 connection allows sharing. Furthermore, the above example allows the first initiating UE to determine whether to initiate a direct communication request or a link modification request to the relay UE based on the number of target UEs.

[0266] The following is combined Figure 7BTaking the aforementioned first device as the initiating UE, the relay device as the relay terminal, the second device as the target UE, the aforementioned first message as the second request, the second message as the first request, the response message of the second message as the first response, and the aforementioned connection specifically as a PC5 connection as an example, the above communication method is illustrated by way of example, specifically including: Step 7201: The initiating UE sends a second request to the relay terminal. The second request (message) includes the identifier of the initiating UE, the identifier of the target UE, and optionally includes service information and the address information of the initiating UE. In this embodiment, the UE identifier can be the UE's application layer identifier and / or link layer identifier (Layer 2 ID), the service information can be the application identifier, service type, relay service code, etc., and the address information can be, for example, IP address, MAC address, etc.

[0267] If the initiating UE determines that there is no PC5 connection between the relay UE and the initiating UE or no PC5 connection for the corresponding service, the second request is a direct communication request message. If a PC5 connection already exists or a PC5 connection for the corresponding service exists, the second request is sent to the relay UE as a link modification request message for the existing PC5 connection, requesting the use of the existing PC5 connection to transmit data between the initiating UE and the target UE.

[0268] Step 7202: If the relay terminal determines that there is no PC5 connection or no corresponding service PC5 connection between the relay UE and the target UE, then the first request is a direct communication request message, which includes the identifier of the initiating UE and optionally includes the address information of the initiating UE.

[0269] If a PC5 connection already exists or a PC5 connection corresponding to the service already exists, a first request is sent to the target UE as a link modification request message for the existing PC5 connection, requesting the use of the existing PC5 connection to transmit data between the initiating UE and the target UE. This message includes the identifier of the initiating UE and optionally includes the address information of the initiating UE.

[0270] Step 7203: The target UE and the relay terminal exchange security information.

[0271] Step 7204: The target UE sends the first response to the relay terminal.

[0272] If the first request is a direct communication request message, the target UE replies to the relay UE with a first response, which is a direct communication acceptance message. This step may optionally include the target UE's address information, and may also carry the maximum number of initiating UEs that the connection can accept; or whether link sharing is accepted.

[0273] The relay UE determines whether the first request it sends to the target UE next is a link modification request message or a direct communication request message, based on the maximum number of initiating UEs that the connection can accept.

[0274] If the instruction carried is to accept link sharing, the first request message sent by the relay UE next time will be a link modification request message; otherwise, it will be a direct communication request message. If the instruction carried is that the current link can accept the maximum number of initiating UEs, the relay UE can calculate the maximum number of initiating UEs supported by the current link, and then decide whether to send a link modification request message or a direct communication request message based on this maximum number.

[0275] If the first request is a link modification request message for an existing PC5 connection, the target UE determines to reuse the existing PC5 connection through a first response (message). The first response (message) could be, for example, a link modification acceptance message for the existing PC5 connection, which optionally includes the target UE's address information. This step also carries the maximum number of initiating UEs acceptable for the connection; or whether to continue accepting link sharing; or whether the current link has reached its maximum acceptable number of initiating UEs. The relay UE determines whether the next first request message sent to the target UE is a link modification request message or a direct communication request message based on the maximum number of initiating UEs acceptable for the connection. If the indication is to continue accepting link sharing, the next first request message sent by the relay UE is a link modification request message; otherwise, it is a direct communication request message. If the indication is that the current link has reached its maximum acceptable number of initiating UEs, the relay UE can calculate the maximum acceptable number of initiating UEs for the current link. In this case, if some initiating UEs stop service and release the link, the relay UE can continue to use the link for other initiating UEs.

[0276] Step 7205: If the second message is a direct communication request message, initiate a secure information exchange between the UE and the relay terminal. In this step, the relay terminal may also optionally obtain the address information of the initiating UE.

[0277] Step 7206: The relay terminal replies with a second response (message) to the initiating UE to complete the establishment or modification of the PC5 link between the relay UE and the initiating UE. This message carries the address information of the target UE. The relay UE determines the address of the target UE, for example, by obtaining it from step 7204, or by obtaining it from the context of an existing PC5 connection between the relay UE and the target UE stored locally.

[0278] This step also includes the maximum number of target UEs that the connection can accept; or whether link sharing is accepted.

[0279] The initiating UE determines whether the next second request message sent to the relay is a link modification request message or a direct communication request message, based on the maximum number of destination UEs that the connection can accept. If the instruction carried is to accept link sharing, then the second request message sent by the UE next time will be a link modification request message; otherwise, it will be a direct communication request message.

[0280] If the indication carried indicates that the maximum number of target UEs currently acceptable for the link has been reached, the initiating UE can calculate the maximum number of target UEs supported by the current link. Based on this maximum number, it then decides whether to send a link modification request message or a direct communication request message as the second request. If some target UEs stop service and release the link, the initiating UE can then continue to use that link for other target UEs. The indication that the maximum number of target UEs currently acceptable for the link has been reached can also be carried in the second rejection message.

[0281] As can be seen, by adopting the above scheme, when the first device needs to connect to the second device through the relay device, the relay device can determine whether to request to share the existing connection with the second device. In this way, the relay device can share the existing connection with the second device to serve multiple initiating devices, thereby improving the link utilization efficiency between the relay device and the second device.

[0282] Furthermore, by adopting the above scheme, when the first device needs to connect to the second device through the relay device, if the relay device and the second device already have a connection, the relay device will only send a message to the second device requesting to share the existing connection if it is determined that the existing connection can be shared. In this way, the same connection can be shared to serve multiple initiating devices. Moreover, because the relay device pre-determines whether the existing connection can be shared, the possibility of the second device rejecting the request to share the existing connection is reduced, avoiding the impact on processing efficiency caused by resending the request, and improving the processing efficiency of the relay device in sharing existing connections.

[0283] The beneficial effects of the solution provided in this embodiment will be further explained below in conjunction with relevant technologies: A UE with ProSe capability can communicate directly with another UE with ProSe capability through the PC5 interface. This direct communication between two UEs can be called unicast short-range communication. Figure 8As shown, UE-1, UE-2, UE-3, and UE-4 are all UEs with ProSe capabilities. When performing direct communication (or unicast short-range communication) processing, in step 801, UE-2 to UE-4 can respectively determine the target layer 2 identifier for signaling reception; in step 802, the application of UE-1 can provide application layer information for unicast short-range communication, and then step 803 is executed; in step 803, UE-1 can send a direct communication request message in a broadcast or unicast manner, and the direct communication request message can be sent to UE-2 to UE-4 respectively. The following describes two possible scenarios. Scenario A) The goal is to establish a near-field link for the UE. Taking the establishment of a near-field link between UE-2 and UE-1 as an example, in step 804a, UE-2 and UE-1 perform a secure establishment process, which means that secure information exchange can be performed. In step 805a, after the secure establishment is completed, UE-2 sends a direct communication acceptance message to UE-1. This direct communication acceptance message can be sent in unicast mode. In step 806a, UE-2 and UE-1 complete the link establishment, and unicast data units can be transmitted through this link. Scenario B) The objective is to establish a short-range link for a service, that is, to establish a connection to carry a specific service. Taking the establishment of a short-range link between UE-4 and UE-1 as an example, in step 804b, UE-4 and UE-1 perform a secure establishment process, that is, they can exchange secure information. In step 805b, after the secure establishment is completed, UE-4 sends a direct communication acceptance message to UE-1. This direct communication acceptance message can be sent in unicast mode. In step 806b, UE-4 and UE-1 complete the link establishment. Unicast data units can be transmitted through this link, and this link carries the service specified by UE-1.

[0284] When two UEs with ProSe capability are far apart and cannot directly establish communication through the PC5 interface, they can also use a Relay UE with ProSe capability as an intermediary for communication relay. For example, ... Figure 9 As shown, Relay UE (i.e. Figure 9 The UE-R in the relay UE can communicate directly with UE1 through the PC5 interface, and can also communicate directly with UE2 through the PC5 interface. In this way, UE1 and UE2 can perform service interaction through the relay UE.

[0285] In related technologies, a method for communication between UEs via UE-R is provided, such as... Figure 10 As shown, UE-1 acts as an initiating UE. UE-1 can establish a separate link between UE-1 and UE-R (i.e., the relay UE) for each target UE (e.g., UE-2, UE-3). Figure 10Link 1-a is used to communicate with UE-2, and link 2-a is used to communicate with UE-3. Similarly, UE-4, as another initiating UE, can also establish a separate link between UE-4 and UE-R for each target UE, for example, Figure 10 Link 3-a is used for communication with UE-2, and link 4-a is used for communication with UE-3. Correspondingly, for each initiating UE (e.g., UE-1, UE-4), a separate link is also established between UE-R and the target UE, such as... Figure 10 As shown, link 1-b is used for communication between UE-1 and UE-2, link 3-b is used for communication between UE-4 and UE-2, link 2-b is used for communication between UE-1 and UE-3, and link 4-b is used for communication between UE-4 and UE-3. In this way, UE-R only needs to associate link 1-a with link 1-b to forward data between UE-1 and UE-2. Correspondingly, 2-a is associated with 2-b, 3-a with 3-b, and 4-a with 4-b.

[0286] In the aforementioned related technologies, as the number of UEs communicating via UE-R increases, the number of links becomes very large, increasing the processing complexity of the relay UE. Moreover, because the number of links that a relay UE can handle is limited, it also greatly restricts the number of UEs that can communicate through the relay UE.

[0287] To control the number of links between a UE and a relay UE, related technologies further propose link sharing. Link sharing can refer to the following: when UE1, as the initiating UE, communicates with UE2 and UE3 (UE2 and UE3 being two target UEs), the link between UE1 and the relay UE can be shared; or when UE1 (an initiating UE) communicates with UE2 (a target UE) and UE4 (another initiating UE) communicates with UE2, the link between UE2 and the relay UE can be shared. Figure 11As shown, in step 1101, the initiating UE sends a direct communication request to the relay terminal, which may carry the identifier of the initiating UE and the identifier of the target UE; in step 1102, the initiating UE and the relay terminal need to exchange security information; in step 1103, when the relay UE decides that the link between it and the target UE can be shared, the first request is a Link Modification Request message, which carries the identifier of the initiating UE; in step 1104, the target UE will determine whether to accept sharing, and if so, it will send a first response to confirm the shared link; in step 1105, the relay UE sends a direct communication acceptance message to the initiating UE, which may carry the address of the target UE. However, in the above step 1104, if the target UE determines that this link cannot be shared by more initiating UEs, the target UE will reject the Link Modification Request message. In this case, the relay UE needs to re-initiate the link establishment process (i.e., the first request becomes a Direct Communication Request message). Conversely, if the relay UE directly initiates the link establishment process, but the target UE believes that it is still communicating with more initiating UEs on the original link, the target UE will reject the link establishment process, and the relay UE needs to re-initiate the link modification process (i.e., the first request becomes a Link Modification Request message).

[0288] It can be seen that in related technologies, the process of sharing a connection or establishing a new connection between a relay UE and a target UE lacks a mechanism to determine whether the existing connection can be shared. This forces the relay UE to re-initiate a request to establish a new link or re-initiate a request to share an existing link. This process of first rejecting and then re-initiating the message increases the service establishment time, thus impacting user experience. However, by adopting the solution provided in this embodiment, when the first device needs to connect to the second device through the relay device, if an existing connection exists between the relay device and the second device, the relay device will only initiate a message to the second device requesting to share the existing connection if it is determined that the existing connection is allowed to be shared. In this way, the same connection can be shared to serve multiple initiating devices. Since the relay device predetermines whether the existing connection can be shared, it reduces the possibility that the second device will reject the request to share the existing connection, avoiding the impact on processing efficiency caused by resending the request and improving the processing efficiency of the relay device in sharing the existing connection. Similarly, since the relay device can only initiate a connection establishment request when it determines that the existing connection cannot be shared or that there is no existing connection, it can also avoid the problem of the second device rejecting the establishment of a new connection and re-initiating the request to share the existing connection, thus ensuring the processing efficiency of the relay device in establishing a new connection.

[0289] Figure 12 This is a schematic diagram of the composition structure of a relay device according to an embodiment of this application, including: The first communication unit 1201 is configured to receive a first message sent by a first device, wherein the first message is used to request a connection with a second device; and to send a second message to the second device, wherein the second message is used to request sharing a first connection to transmit data between the first device and the second device, or the second message is used to request establishing a second connection between the relay device and the second device to transmit data between the first device and the second device.

[0290] The first communication unit is configured to send a second message to the second device when a first connection exists between the first unit and the second device and the first connection is in a state where sharing is permitted. The second message is used to request sharing the first connection to transmit data between the first device and the second device.

[0291] In one possible implementation, the first communication unit is configured to send a second message to the second device when a first connection exists between the relay device and the second device and the first connection is in a state where sharing is not allowed. The second message is used to request the establishment of a second connection between the relay device and the second device to transmit data between the first device and the second device.

[0292] In one possible implementation, the first communication unit is configured to send a second message to the second device when there is no connection between the first device and the second device. The second message is used to request the establishment of a second connection between the relay device and the second device to transmit data between the first device and the second device.

[0293] In one possible implementation, the first message carries information about the target service.

[0294] In one possible implementation, the first connection carries the target service.

[0295] In one possible implementation, the first connection does not carry the target service, and there is no connection between the relay device and the second device carrying the target service.

[0296] In one possible implementation, the second message carries information about the target service.

[0297] In one possible implementation, Figure 12 On the basis of, such as Figure 13 As shown, the relay device further includes: a first processing unit 1202, used to determine whether the first connection is in a state where sharing is allowed based on the first status indication information of the first connection.

[0298] In one possible implementation, the first processing unit is configured to perform one of the following: determining that the first connection is in a sharing-allowed state if the first status indication information of the first connection includes an indication that the first connection accepts sharing; determining that the first connection is in a sharing-allowed state if the first status indication information of the first connection includes a maximum number of initiating devices capable of sharing the first connection and the current number of initiating devices that have already shared the first connection is less than the maximum number; determining that the first connection is in a sharing-allowed state if the first status indication information of the first connection includes an indication that the number of initiating devices that have already shared the first connection has not reached the maximum number; and determining that the first connection is in a sharing-allowed state if the first status indication information of the first connection includes a first remaining number of initiating devices capable of sharing the first connection and the first remaining number is not zero.

[0299] In one possible implementation, the first processing unit is configured to perform one of the following: determining that the first connection is in a sharing-allowed state if the first status indication information of the first connection includes an indication that the target service carried by the first connection accepts sharing; determining that the first connection is in a sharing-allowed state if the first status indication information of the first connection includes a maximum number of initiating devices capable of sharing the target service carried by the first connection, and the current number of initiating devices that have already shared the target service carried by the first connection is less than the maximum number; determining that the first connection is in a sharing-allowed state if the first status indication information of the first connection includes an indication that the number of initiating devices that have already shared the target service carried by the first connection has not reached the maximum number; and determining that the first connection is in a sharing-allowed state if the first status indication information of the first connection includes a first remaining number of initiating devices capable of sharing the target service carried by the first connection, and the first remaining number is not zero.

[0300] In one possible implementation, the first communication unit is configured to send a second message to the second device and then receive a response message to the second message sent by the second device. The response message to the second message is used to indicate whether the second device agrees to share the first connection, and the response message to the second message carries second status indication information of the first connection. The second status indication information of the first connection is used by the relay device to determine whether the first connection is in a state that allows sharing in the next time.

[0301] In one possible implementation, the first message is further configured to request sharing a third connection between the first device and the relay device; the first communication unit is configured to, after receiving a response message of the second message sent by the second device, send a sharing confirmation response to the first device if the response message of the second message indicates that the second device agrees to share the first connection and the relay device determines to share the third connection.

[0302] In one possible implementation, the first message is further configured to request the establishment of a fourth connection between the first device and the relay device; the first communication unit is configured to, after receiving the response message of the second message sent by the second device, send a connection confirmation response to the first device if the response message of the second message indicates that the second device agrees to share the first connection and completes the establishment of the fourth connection.

[0303] In one possible implementation, the first communication unit is configured to send a second message to the second device and then receive a response message to the second message sent by the second device. The response message to the second message is used to indicate whether the second device and the relay device have completed establishing the second connection.

[0304] In one possible implementation, the first message is further configured to request sharing of a third connection between the first device and the relay device; the first communication unit is configured to, after receiving a response message to the second message sent by the second device, send a sharing confirmation response to the first device if the response message to the second message indicates that the second device and the relay device have completed establishing the second connection and the relay device has determined to share the third connection.

[0305] In one possible implementation, the sharing confirmation response carries a second status indication information of the third connection, which is used by the first device to determine whether the third connection is in a state where sharing is permitted.

[0306] In one possible implementation, the first message is further configured to request the establishment of a fourth connection between the first device and the relay device; the first communication unit is configured to, after receiving the response message of the second message sent by the second device, send a connection confirmation response to the first device if the response message of the second message indicates that the second device and the relay device have completed the establishment of the second connection and the fourth connection.

[0307] In one possible implementation, the connection confirmation response carries a status indication information of a fourth connection, which is used by the first device to determine whether the fourth connection is in a state where sharing is permitted.

[0308] In one possible implementation, when the response message of the second message is used to indicate that the second device and the relay device have completed establishing the second connection, the response message of the second message carries status indication information of the second connection, which is used by the relay device to determine whether the second connection is in a state where sharing is allowed.

[0309] The relay device in this application embodiment can realize the corresponding functions of the relay device in the aforementioned communication method embodiments. The processes, functions, implementation methods, and beneficial effects of each module (sub-module, unit, or component, etc.) in this relay device can be found in the corresponding descriptions in the above method embodiments, and will not be repeated here. It should be noted that the functions described for each module (sub-module, unit, or component, etc.) in the relay device of this application embodiment can be implemented by different modules (sub-modules, units, or components, etc.) or by the same module (sub-module, unit, or component, etc.).

[0310] Figure 14 This is a schematic diagram of the composition structure of a first device according to an embodiment of this application, including: The second communication unit 1401 is configured to send a first message to a relay device, wherein the first message is configured to request a connection with the second device, and the first message is configured to trigger the relay device to send a second message to the second device, wherein the second message is configured to request sharing a first connection to transmit data between the first device and the second device, or the second message is configured to request establishing a second connection between the relay device and the second device to transmit data between the first device and the second device.

[0311] In one possible implementation, the second communication unit is configured to send the first message to the relay device when a third connection exists between the second unit and the third connection is in a state where sharing is permitted. The first message is further configured to request sharing of the third connection.

[0312] In one possible implementation, the second communication unit is configured to send the first message to the relay device when a third connection exists between the first device and the relay device and the third connection is in a state where sharing is not allowed. The first message is further configured to request the establishment of a fourth connection between the first device and the relay device.

[0313] In one possible implementation, the second communication unit is configured to send the first message to the relay device when there is no connection between the second unit and the relay device, wherein the first message is further configured to request the establishment of a fourth connection between the first device and the relay device.

[0314] In one possible implementation, the first message carries information about the target service.

[0315] In one possible implementation, the third connection carries the target service.

[0316] In one possible implementation, the third connection does not carry the target service, and there is no connection between the first device and the relay device carrying the target service.

[0317] In one possible implementation, Figure 14 On the basis of, such as Figure 15 As shown, the first device further includes: a second processing unit 1402, used to determine whether the third connection is in a state of being allowed to share based on the first status indication information of the third connection.

[0318] In one possible implementation, the second processing unit is configured to perform one of the following: if the first status indication information of the third connection includes an indication that the third connection accepts sharing, determine that the third connection is in a sharing-allowed state; if the first status indication information of the third connection includes a maximum number of target devices that can share the third connection, and the number of target devices that have already shared the third connection is less than the maximum number, determine that the third connection is in a sharing-allowed state; if the first status indication information of the third connection includes an indication that the number of target devices that have already shared the third connection has not reached the maximum number, determine that the third connection is in a sharing-allowed state; if the first status indication information of the third connection includes a second remaining number of target devices that can share the third connection, and the second remaining number is not zero, determine that the third connection is in a sharing-allowed state.

[0319] In one possible implementation, the second processing unit is configured to perform one of the following: if the first status indication information of the third connection includes an indication that the target service carried by the third connection accepts sharing, determine that the third connection is in a sharing-allowed state; if the first status indication information of the third connection includes a maximum number of target devices capable of sharing the target service carried by the third connection, and the number of target devices that have already shared the target service carried by the third connection is less than the maximum number, determine that the third connection is in a sharing-allowed state; if the first status indication information of the third connection includes an indication that the number of target devices that have already shared the target service carried by the third connection has not reached the maximum number, determine that the third connection is in a sharing-allowed state; if the first status indication information of the third connection includes a second remaining number of target devices capable of sharing the target service carried by the third connection, and the second remaining number is not zero, determine that the third connection is in a sharing-allowed state.

[0320] In one possible implementation, the second communication unit is configured to, after sending the first message to the relay device, receive a sharing confirmation response from the relay device; the second processing unit is configured to determine that the third connection is shared and that the first device and the second device have completed the connection.

[0321] In one possible implementation, the sharing confirmation response carries a second status indication information of the third connection, which is used by the first device to determine whether the third connection is in a state where sharing is permitted.

[0322] In one possible implementation, the second communication unit is configured to, after sending the first message to the relay device, receive a connection confirmation response from the relay device; the second processing unit is configured to determine that the fourth connection is established and that the first device and the second device have completed the connection.

[0323] In one possible implementation, the connection confirmation response carries a status indication information of a fourth connection, which is used by the first device to determine whether the fourth connection is in a state where sharing is permitted.

[0324] The first device in this application embodiment can realize the corresponding functions of the first device in the foregoing communication method embodiments. The processes, functions, implementation methods, and beneficial effects of each module (sub-module, unit, or component, etc.) in the first device can be found in the corresponding descriptions in the above method embodiments, and will not be repeated here. It should be noted that the functions described for each module (sub-module, unit, or component, etc.) in the first device of this application embodiment can be implemented by different modules (sub-modules, units, or components, etc.) or by the same module (sub-module, unit, or component, etc.).

[0325] Figure 16 This is a schematic diagram of the composition structure of a second device according to an embodiment of this application, including: The third communication unit 1601 is used to receive a second message sent by the relay device, wherein the second message is used to request sharing the first connection to transmit data between the first device and the second device, or the second message is used to request establishing a second connection between the relay device and the second device to transmit data between the first device and the second device.

[0326] In one possible implementation, the second message carries information about the target service.

[0327] In one possible implementation, the first connection carries the target service.

[0328] In one possible implementation, the first connection does not carry the target service, and there is no connection between the relay device and the second device carrying the target service.

[0329] In one possible implementation, the second message is used to request sharing the first connection to transmit data between the first device and the second device; the third communication unit is used to send a response message of the second message to the relay device after receiving the second message sent by the relay device, wherein the response message of the second message is used to indicate whether the second device agrees to share the first connection, and the response message of the second message carries second status indication information of the first connection, the second status indication information of the first connection being used by the relay device to determine whether the first connection is in a state that allows sharing in the next time.

[0330] In one possible implementation, the third communication unit is configured to perform one of the following: if the second device determines that it will share the first connection, it sends a response message to the relay device containing the second message indicating that the second device agrees to share the first connection; if the second device determines that it will not share the first connection, it sends a response message to the relay device containing the second message indicating that the second device refuses to share the first connection.

[0331] In one possible implementation, the second status indication information of the first connection includes at least one of the following: an indication of whether the first connection accepts sharing; the maximum number of initiating devices that can share the first connection; an indication of whether the number of initiating devices that have shared the first connection has reached the maximum number; and a third remaining number of initiating devices that can share the first connection.

[0332] In one possible implementation, Figure 16 On the basis of, such as Figure 17 As shown, the first device further includes: a third processing unit 1602, configured to, upon determining that the first connection is shared and the target service is added to the first connection, send a response message via the third communication unit to the relay device, indicating that the second device agrees to share the first connection.

[0333] In one possible implementation, the second status indication information of the first connection includes at least one of the following: whether the target service carried by the first connection accepts sharing; the maximum number of initiating devices capable of sharing the target service carried by the first connection; whether the number of initiating devices that have shared the target service carried by the first connection has reached the maximum number; and a third remaining number of initiating devices capable of sharing the target service carried by the first connection.

[0334] In one possible implementation, the second message is used to request the establishment of a second connection between the relay device and the second device to transmit data between the first device and the second device; the third communication unit is used to send a response message of the second message to the relay device after receiving the second message sent by the relay device, the response message of the second message being used to indicate whether the second device and the relay device have completed the establishment of the second connection.

[0335] In one possible implementation, when the response message of the second message is used to indicate that the second device and the relay device have completed establishing the second connection, the response message of the second message carries status indication information of the second connection, which is used by the relay device to determine whether the second connection is in a state that allows sharing in the next time.

[0336] The second device in this application embodiment can implement the corresponding functions of the second device in the aforementioned communication method embodiments. The processes, functions, implementation methods, and beneficial effects of each module (sub-module, unit, or component, etc.) in the second device can be found in the corresponding descriptions in the above method embodiments, and will not be repeated here. It should be noted that the functions described for each module (sub-module, unit, or component, etc.) in the second device of this application embodiment can be implemented by different modules (sub-modules, units, or components, etc.) or by the same module (sub-module, unit, or component, etc.).

[0337] Figure 18 This is a schematic structural diagram of a communication device 1800 according to an embodiment of this application. The communication device 1800 includes a processor 1810, which can call and run computer programs from memory to enable the communication device 1800 to implement the methods in the embodiments of this application.

[0338] In one possible implementation, the communication device 1800 may further include a memory 1820. The processor 1810 can retrieve and run computer programs from the memory 1820 to enable the communication device 1800 to implement the methods described in the embodiments of this application.

[0339] The memory 1820 can be a separate device independent of the processor 1810, or it can be integrated into the processor 1810.

[0340] In one possible implementation, the communication device 1800 may further include a transceiver 1830, which the processor 1810 can control to communicate with other devices. Specifically, it can send information or data to other devices or receive information or data sent by other devices.

[0341] The transceiver 1830 may include a transmitter and a receiver. The transceiver 1830 may further include an antenna, and the number of antennas may be one or more.

[0342] In one possible implementation, the communication device 1800 may be a relay device in the embodiments of this application, and the communication device 1800 may implement the corresponding processes implemented by the relay device in the various methods of the embodiments of this application. For simplicity, further details are omitted here. In one possible implementation, the communication device 1800 may be a first device in the embodiments of this application, and the communication device 1800 may implement the corresponding processes implemented by the first device in the various methods of the embodiments of this application. For simplicity, further details are omitted here. In one possible implementation, the communication device 1800 may be a second device in the embodiments of this application, and the communication device 1800 may implement the corresponding processes implemented by the second device in the various methods of the embodiments of this application. For simplicity, further details are omitted here.

[0343] Figure 19 This is a schematic structural diagram of a chip 1900 according to an embodiment of this application. The chip 1900 includes a processor 1910, which can call and run computer programs from memory to implement the methods in the embodiments of this application.

[0344] In one possible implementation, chip 1900 may further include memory 1920. Processor 1910 can retrieve and run computer programs from memory 1920 to implement the methods executed by the relay device, the first device, and the second device in this embodiment. Memory 1920 may be a separate device independent of processor 1910, or it may be integrated into processor 1910.

[0345] In one possible implementation, the chip 1900 may further include an input interface 1930. The processor 1910 can control the input interface 1930 to communicate with other devices or chips; specifically, it can acquire information or data sent by other devices or chips. In another possible implementation, the chip 1900 may further include an output interface 1940. The processor 1910 can control the output interface 1940 to communicate with other devices or chips; specifically, it can output information or data to other devices or chips.

[0346] In one possible implementation, the chip can be applied to the relay device in the embodiments of this application, and the chip can implement the corresponding processes implemented by the relay device in the various methods of the embodiments of this application. For simplicity, details are omitted here. In one possible implementation, the chip can be applied to the first device in the embodiments of this application, and the chip can implement the corresponding processes implemented by the first device in the various methods of the embodiments of this application. For simplicity, details are omitted here. In one possible implementation, the chip can be applied to the second device in the embodiments of this application, and the chip can implement the corresponding processes implemented by the second device in the various methods of the embodiments of this application. For simplicity, details are omitted here.

[0347] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0348] The processors mentioned above can be general-purpose processors, digital signal processors (DSPs), field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), or other programmable logic devices, transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processors mentioned above can be microprocessors or any conventional processor.

[0349] The aforementioned memory can be volatile memory or non-volatile memory, or a combination of both. 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. Volatile memory can be random access memory (RAM).

[0350] It should be understood that the above-described memory is exemplary and not a limiting description. For example, the memory in the embodiments of this application may also be 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 link dynamic random access memory (SLDRAM), and direct memory bus RAM (DR RAM), etc. That is to say, the memory in the embodiments of this application is intended to include, but is not limited to, these and any other suitable types of memory.

[0351] Figure 20 This is a schematic block diagram of a communication system 2000 according to an embodiment of this application. The communication system 2000 includes a relay device 2010, a first device 2020, and a second device 2030. The relay device 2010 can be used to implement the corresponding functions implemented by the relay device in the above-described method. The first device 2020 can be used to implement the corresponding functions implemented by the first device in the above-described method. The second device 2030 can be used to implement the corresponding functions implemented by the second device in the above-described method.

[0352] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. This computer program product includes one or more computer instructions. When these computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are 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., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).

[0353] It should be understood that in the various embodiments of this application, the order of the above-mentioned processes does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0354] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0355] The above description is merely a specific embodiment 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 communication method, comprising: The relay device receives a first message sent by the first device, wherein the first message is used to request a connection with the second device; The relay device sends a second message to the second device, wherein the second message is used to request sharing the first connection to transmit data between the first device and the second device, or the second message is used to request establishing a second connection between the relay device and the second device to transmit data between the first device and the second device.

2. The method according to claim 1, wherein, The relay device sends a second message to the second device, including: When a first connection exists between the relay device and the second device, and the first connection is in a state where sharing is permitted, the relay device sends a second message to the second device. The second message is used to request sharing the first connection to transmit data between the first device and the second device.

3. The method according to claim 1, wherein, The relay device sends a second message to the second device, including: When a first connection exists between the relay device and the second device, and that first connection is in a state where sharing is not allowed, the relay device sends a second message to the second device. This second message requests the establishment of a second connection between the relay device and the second device to transmit data between the first device and the second device; or... The relay device sends a second message to the second device, including: When there is no connection between the relay device and the second device, the relay device sends a second message to the second device. The second message is used to request the establishment of a second connection between the relay device and the second device to transmit data between the first device and the second device.

4. The method according to any one of claims 1-3, wherein, The method further includes: If the relay device determines that the first connection is in a sharing-allowed state when the first status indication information of the first connection includes an indication that the first connection accepts sharing; If the relay device determines that the first connection is in a sharing-allowed state when the first status indication information of the first connection includes the maximum number of initiating devices that can share the first connection, and the current number of initiating devices that have already shared the first connection is less than the maximum number; If the relay device determines that the first connection is in a sharing-allowed state when the first status indication information of the first connection includes an indication that the number of initiating devices that have shared the first connection has not reached the maximum number; If the relay device determines that the first connection is in a sharing-allowed state when the first status indication information of the first connection includes a first remaining number of initiating devices that can share the first connection and the first remaining number is not zero; If the first status indication information of the first connection includes an indication that the target service carried by the first connection accepts sharing, then the first connection is determined to be in a state where sharing is allowed. If the first status indication information of the first connection includes the maximum number of initiating devices that can share the target service carried by the first connection, and the current number of initiating devices that have shared the target service carried by the first connection is less than the maximum number, then the first connection is determined to be in a state where sharing is allowed. If the first status indication information of the first connection includes an indication that the number of initiating devices that have shared the target service carried by the first connection has not reached the maximum number, the first connection is determined to be in a state where sharing is allowed. If the first status indication information of the first connection includes a first remaining number of initiating devices capable of sharing the target service carried by the first connection, and the first remaining number is not zero, then the first connection is determined to be in a state where sharing is permitted.

5. The method according to claim 2, wherein, After the relay device sends the second message to the second device, the method further includes: The relay device receives a response message to the second message sent by the second device, wherein the response message to the second message is used to indicate whether the second device agrees to share the first connection, and the response message to the second message carries second status indication information of the first connection.

6. A communication method, comprising: The second device receives a second message sent by the relay device, wherein the second message is used to request sharing the first connection to transmit data between the first device and the second device, or the second message is used to request establishing a second connection between the relay device and the second device to transmit data between the first device and the second device.

7. The method according to claim 6, wherein, The first connection carries the target service; or The first connection does not carry the target service, and there is no connection between the relay device and the second device that carries the target service.

8. The method according to claim 6 or 7, wherein, The second message is used to request sharing the first connection to transmit data between the first device and the second device; After the second device receives the second message sent by the relay device, the method further includes: The second device sends a response message to the relay device for the second message, wherein the response message for the second message is used to indicate whether the second device agrees to share the first connection, and the response message for the second message carries second status indication information of the first connection.

9. The method according to claim 8, wherein, The second device sends a response message to the relay device for the second message, including one of the following: If the second device determines that it agrees to share the first connection, it sends a response message to the relay device, indicating that the second device agrees to share the first connection. If the second device determines that it will not share the first connection, it sends a response message to the relay device, indicating that the second device refuses to share the first connection.

10. The method according to claim 8 or 9, wherein, The second status indication information of the first connection includes at least one of the following: Whether the first connection accepts the sharing instruction; The maximum number of initiating devices that can share the first connection; An indication of whether the number of initiating devices that have shared the first connection has reached the maximum number; The third remaining number of devices that can share the initiating device of the first connection.

11. The method according to claim 9, wherein, If the second device determines that it agrees to share the first connection, it sends a response message to the relay device, indicating that the second device agrees to share the first connection, including: If the second device determines that it will share the first connection and add the target service to the first connection, it sends a response message to the relay device, indicating that the second device agrees to share the first connection.

12. A relay device, comprising: A first communication unit is configured to receive a first message sent by a first device, wherein the first message is used to request a connection with a second device; and to send a second message to the second device, wherein the second message is used to request sharing a first connection to transmit data between the first device and the second device, or the second message is used to request establishing a second connection between the relay device and the second device to transmit data between the first device and the second device.

13. The relay device according to claim 12, wherein, The first communication unit is configured to send a second message to the second device when a first connection exists between the first unit and the second device and the first connection is in a state where sharing is permitted. The second message is used to request sharing the first connection to transmit data between the first device and the second device.

14. The relay device according to claim 13, wherein, The first communication unit is configured to send a second message to the second device and then receive a response message to the second message sent by the second device, wherein the response message to the second message is used to indicate whether the second device agrees to share the first connection, and the response message to the second message carries second status indication information of the first connection.

15. A second device, comprising: The third communication unit is configured to receive a second message sent by the relay device, wherein the second message is configured to request sharing a first connection to transmit data between the first device and the second device, or the second message is configured to request establishing a second connection between the relay device and the second device to transmit data between the first device and the second device.

16. The second device according to claim 15, wherein, The second message is used to request sharing the first connection to transmit data between the first device and the second device; The third communication unit is configured to send a response message of the second message to the relay device after receiving the second message sent by the relay device, wherein the response message of the second message is used to indicate whether the second device agrees to share the first connection, and the response message of the second message carries second status indication information of the first connection.

17. The second device according to claim 16, wherein, The third communication unit is configured to perform one of the following: if the second device determines that it will share the first connection, it sends a response message to the relay device indicating that the second device agrees to share the first connection; if the second device determines that it will not share the first connection, it sends a response message to the relay device indicating that the second device refuses to share the first connection.

18. The second device according to claim 16 or 17, wherein, The second status indication information of the first connection includes at least one of the following: an indication of whether the first connection accepts sharing; the maximum number of initiating devices that can share the first connection; an indication of whether the number of initiating devices that have shared the first connection has reached the maximum number; and a third remaining number of initiating devices that can share the first connection.

19. The second device according to claim 17, further comprising: The third processing unit is configured to, upon determining that the first connection is shared and the target service is added to the first connection, send a response message via the third communication unit to the relay device, indicating that the second device agrees to share the first connection.

20. A relay device, comprising: A transceiver, a processor, and a memory for storing a computer program, the processor for calling and running the computer program stored in the memory to cause the relay device to perform the method as described in any one of claims 1 to 5.

21. A second device, comprising: A transceiver, a processor, and a memory for storing a computer program, the processor for calling and running the computer program stored in the memory to cause the second device to perform the method as described in any one of claims 6 to 11.