A networking method, device and system

By introducing a new P2P connection and data transfer station mechanism in WiFi P2P connection, the communication interruption problem caused by fixed device roles is solved, seamless communication between multiple devices is achieved, and user experience and networking efficiency are improved.

CN114390491BActive Publication Date: 2025-09-30NOKIA TECHNOLOGIES OY
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011125466.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-20
Publication Date
2025-09-30
Estimated Expiration
2040-10-20

AI Technical Summary

Technical Problem

In a WiFi P2P connection, when the device role is fixed, other devices cannot establish a connection with the existing GC device, resulting in communication interruption or rejection of connection requests, affecting the user experience.

Method used

When the original GC device receives a connection request, it returns an instruction to establish a new P2P connection, and uses the GO device as a data transfer station to achieve seamless communication between multiple devices.

Benefits of technology

Without interrupting the original P2P connection, other devices are allowed to communicate with the GC device, which improves the WiFi P2P communication experience of multiple devices used simultaneously, and improves networking efficiency and user satisfaction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114390491B_ABST
    Figure CN114390491B_ABST
Patent Text Reader

Abstract

The present application provides a networking method, apparatus, and system, in which: a first P2P connection is established between a second device and a first device, the first device is a GO role in the group, and the second device is a GC role in the group; the second device receives a first P2P connection request from a third device; when the second device determines that it cannot establish a P2P connection with the third device, it returns first information to the third device, so that the third device establishes a second P2P connection with the first device based on the first information; then the second device establishes a TCP connection with the third device based on the first P2P connection and the second P2P connection. This method establishes a P2P connection between the third device and the first device in the GC role when the P2P connection established between the second device and the first device is not disconnected, thereby enabling the second device and the third device to communicate over short distances in a WiFi P2P manner, which can improve the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a networking method, device and system. Background Art

[0002] Currently, after two devices establish a wireless fidelity (WiFi) peer-to-peer (P2P) connection, they can establish an upper-layer Transmission Control Protocol (TCP) / User Datagram Protocol (UDP) connection and then communicate data via the TCP / UDP connection, i.e., perform short-range communication using WiFi P2P. After the two devices establish a P2P connection, the devices corresponding to the group owner (GO) / group client (GC) roles in the P2P connection are fixed (for example, after a first device and a second device establish a P2P connection, the first device assumes the GO role and the second device assumes the GC role). The GO and GC devices then perform short-range communication using WiFi P2P.

[0003] When other devices need to communicate with the GC device (i.e., the second device) in a short-distance WiFi P2P manner, the other devices will send a P2P establishment request to the GC device. However, at this time, the role of the second device has been fixed as the GC role and has established a P2P connection with the corresponding GO device. It can no longer negotiate roles with other devices. Therefore, the second device either rejects the P2P establishment request, and other devices cannot communicate with the second device in a short-distance WiFi P2P manner, or disconnects the P2P connection with the original GO device (i.e., the first device) and then establishes a P2P connection with other devices. However, this will cause the ongoing services of the original GC device and the original GO device to be interrupted. Summary of the Invention

[0004] The embodiments of the present application provide a networking method, apparatus, and system for adding other devices to perform short-range communication with the original GC device while maintaining the P2P connection between the original GO device and the GC device, thereby improving the user experience of using multiple devices simultaneously for short-range communication in a WiFi P2P manner.

[0005] In a first aspect, a networking method is provided, which is applied to a second device. In the networking method, a first P2P connection is established between the second device and the first device, the first device plays the role of a manager GO in the group, and the second device plays the role of a client GC in the group. After the second device receives a first P2P connection request from a third device, if it determines that it cannot establish a P2P connection with the third device, it can return first information to the third device, and the first information is used to instruct the third device to establish a second P2P connection with the first device; after the third device establishes the second P2P connection with the first device, the second device can establish an upper-layer Transmission Control Protocol TCP connection with the third device based on the first P2P connection and the second P2P connection.

[0006] In an embodiment of the present application, after the original GC device (i.e., the second device) and the GO device (i.e., the first device) establish a first P2P connection, if the original GC device receives a P2P connection request from another device, it can send a first message to the other device to instruct the other device to establish a second P2P connection with the GO device, and then establish a TCP connection with the other device based on the first P2P connection and the second P2P connection. In this way, the GC device can use the GO device as a data transfer station to conduct short-range communication with the other device in a WiFi P2P manner without interrupting the original P2P connection, effectively improving the user experience of using multiple devices simultaneously for short-range communication in a WiFi P2P manner.

[0007] In one possible design, after the second device determines that it cannot establish a P2P connection with the third device, before returning the first information to the third device, it may also send a query request to the first device, and then receive a first response message from the first device; wherein the query request is used to query whether the first device is allowed to access the new GC device, and the first response message is used to indicate that the first device is allowed to access the new GC device.

[0008] In this design, the original GC device (i.e., the second device) queries the GO device (i.e., the first device) whether access to the new GC device is allowed. Only when the first device allows access to the new GC device, does it return the first information to the third device (instructing the third device to establish a second P2P connection with the first device). This can avoid the third device executing the process of establishing a second P2P connection with the first device when the GO device does not allow access to the new GC device, reduce the probability of failure of the third device to establish the second P2P connection, thereby improving networking efficiency and further improving user experience.

[0009] In one possible design, the first information includes: link establishment information of the first device.

[0010] In this design, other devices (ie, third devices) do not need to perform role negotiation with the GO device, which effectively improves the efficiency of establishing P2P connections between other devices and the GO device, and can further enhance user experience.

[0011] In one possible design, the first information includes: link establishment information of the first device, the P2P port and IP address allocated by the first device to the third device.

[0012] In this design, the first information includes the P2P port and IP address assigned by the GO device to the third device. Other devices (i.e., the third device) do not need to negotiate roles with the GO device, nor do they need to query the GO device for the P2P port and IP address. This improves the efficiency of establishing P2P connections between other devices and the GO device, thereby effectively improving networking efficiency and further enhancing user experience.

[0013] In one possible design, the first P2P connection request carries link establishment information of the third device; after receiving the first P2P connection request and before sending a query request to the first device, the second device can also determine whether the P2P port of the third device is available based on the link establishment information of the third device.

[0014] In this design, after receiving a P2P connection request from another device (i.e., a third device), the original GC device (i.e., the second device) can determine whether the P2P port of the other device is available based on the link establishment information of the other device carried in the P2P connection request. This avoids the need to establish a second P2P connection with the first device when the third device's P2P port is unavailable, reducing the probability of failure for the third device to establish the second P2P connection, thereby improving networking efficiency and further enhancing the user experience.

[0015] In one possible design, after receiving the first P2P connection request and before sending a query request to the first device, the second device may also send a low-power Bluetooth BLE connection request to the third device; receive a third response message from the third device, where the third response message is used to indicate that the third device agrees to establish a BLE connection with the second device; establish a BLE connection with the third device, and receive third information from the third device through the BLE connection, where the third information carries link establishment information of the third device; and determine that the P2P port of the third device is available based on the link establishment information of the third device.

[0016] In this design, after receiving a P2P connection request from another device (i.e., a third device), the original GC device (i.e., the second device) can receive link establishment information from the third device via a BLE connection and determine whether the third device's P2P port is available. This avoids the need to establish a second P2P connection with the first device if the third device's P2P port is unavailable, reducing the chance of failure for the third device to establish the second P2P connection and further improving networking efficiency.

[0017] In one possible design, after the third device establishes a second P2P connection with the first device, the specific implementation method of the second device establishing an upper-layer Transmission Control Protocol TCP connection between the second device and the third device based on the first P2P connection and the second P2P connection may be: receiving a request message forwarded by the first device, where the request message is information used by the third device to request to establish a TCP connection with the second device, and the request message carries the first TCP port used by the third device to establish the TCP connection; in response to the request message, sending a fourth response message to the third device through the first device, where the fourth response message carries the second TCP port used by the second device to establish the TCP connection.

[0018] In this design, the original GC device (i.e., the second device) can establish a TCP connection with the new GC device (i.e., the third device) based on the first P2P connection and the second P2P connection, so that the original GC device can communicate with the new GC device over a short distance in a WiFi P2P manner, effectively improving the communication efficiency between the original GC device and the new GC device.

[0019] In a second aspect, a networking method is provided, applying a third device, the method comprising: sending a first P2P connection request to the second device; wherein the second device and the first device establish a first P2P connection, the first device plays the role of a manager GO in the group, and the second device plays the role of a client GC in the group; then receiving first information from the second device, the first information being sent by the second device when the second device is unable to establish a P2P connection with the third device; the first information being used to instruct the third device to establish a second P2P connection with the first device; establishing a second P2P connection with the first device according to the first information; and the third device can establish an upper-layer Transmission Control Protocol TCP connection with the second device based on the first P2P connection and the second P2P connection.

[0020] In one possible design, the first information includes link establishment information of the first device; the third device establishes a second P2P connection with the first device based on the first information, which can be: sending a second P2P establishment request to the first device; receiving a second response message from the first device, the second response message carries the P2P port and IP address allocated by the first device to the third device; based on the P2P port and IP address, establishing a P2P connection with the first device in the GC role.

[0021] In one possible design, the first information includes: link establishment information of the first device, the P2P port and IP address allocated by the first device to the third device; based on the first information, a second P2P connection is established with the first device, including: based on the P2P port and IP address, a second P2P connection is established with the first device in the GC role.

[0022] In one possible design, the first P2P connection request carries link establishment information of the third device.

[0023] In one possible design, after sending the first P2P connection request to the second device, the third device may also: receive a BLE connection request from the second device; send a third response message to the second device, where the third response message is used to indicate that the third device agrees to establish a BLE connection with the second device, so that the second device and the third device establish a BLE connection; send third information to the second device via the BLE connection, where the third information carries link establishment information of the third device, and the link establishment information of the third device is used to indicate that the P2P port of the third device is available.

[0024] In one possible design, the third device establishes an upper-layer Transmission Control Protocol TCP connection with the second device based on the first P2P connection and the second P2P connection, including: sending a request message to the second device through the first device, the request message is used to request to establish a TCP connection with the second device, and the request message carries a first TCP port used by the third device to establish the TCP connection; receiving a fourth response message from the second device through the first device, the fourth response message carries a second TCP port used by the second device to establish the TCP connection; and establishing a TCP connection with the second device based on the first TCP port and the second TCP port.

[0025] In a third aspect, a networking method is provided, which is applied to a first device, wherein a first point-to-point (P2P) connection is established between the first device and a second device, wherein the first device plays the role of a group manager (GO) and the second device plays the role of a group client (GC). The method comprises: establishing a second P2P connection with a third device based on first information; and establishing an upper-layer Transmission Control Protocol (TCP) connection between the second device and the third device based on the first and second P2P connections. The first information is sent to the third device when the third device requests to establish a P2P connection with the second device and the second device confirms that a P2P connection cannot be established with the third device. The first information is used to instruct the third device to establish the second P2P connection with the first device.

[0026] In one possible design, before the first device establishes a second P2P connection with the third device, the method also includes: receiving a query request from the second device, and sending a first response message to the second device in response to the query request; wherein, the query request is used to query whether the first device is allowed to access a new GC device, and the first response message is used to indicate that the first device is allowed to access the new GC device.

[0027] In one possible design, the first device establishes a second P2P connection with a third device, including: receiving a second P2P establishment request from the third device; and sending a second response message to the third device in response to the second P2P establishment request, the second response message carrying the P2P port and IP address allocated by the first device to the third device.

[0028] In one possible design, the first device establishes an upper-layer TCP connection between the second device and the third device based on the first P2P connection and the second P2P connection, which can be: receiving request information from the third device through the second P2P connection, and forwarding the request information to the second device through the first P2P connection; the request information is used to indicate that the third device requests to establish a TCP connection with the second device, and the request information carries the first TCP port used by the third device to establish the TCP connection; receiving a fourth response message from the second device through the first P2P connection, the fourth response message carrying the second TCP port used by the second device to establish the TCP connection; and forwarding the fourth response message to the third device through the second P2P connection.

[0029] In a fourth aspect, a networking device is provided, which is applied to a second device in a networking system. The networking system also includes a first device and a second device establishing a first P2P connection. The first device is the manager GO role in the group, and the second device is the client GC role in the group. The networking device includes a module / unit for executing the method described in the above-mentioned first aspect or any possible design of the first aspect.

[0030] Exemplarily, the networking device may include:

[0031] A communication module, configured to receive a first P2P connection request from a third device;

[0032] The communication module is further configured to, upon determining that the communication module itself cannot establish a P2P connection with the third device, return the first information to the third device, so that the third device establishes a second P2P connection with the first device according to the first information;

[0033] The processing module is configured to establish an upper layer Transmission Control Protocol (TCP) connection with the third device based on the first P2P connection and the second P2P connection after the third device establishes a second P2P connection with the first device.

[0034] In the fifth aspect, a networking device is provided, which is applied to a third device in a networking system. The networking system also includes a first device and a second device, wherein the first device and the second device establish a first P2P connection, and the first device is the manager GO role in the group, and the second device is the client GC role in the group. The networking device includes a module / unit for executing the method described in the above second aspect or any possible design of the second aspect.

[0035] Exemplarily, the networking device may include:

[0036] A communication module, configured to send a first P2P connection request to a second device;

[0037] The communication module is further configured to receive first information from a second device, the first information being sent by the second device when the second device is unable to establish a P2P connection with a third device; the first information being used to instruct the third device to establish a second P2P connection with the first device;

[0038] a processing module, configured to establish a second P2P connection with the first device according to the first information;

[0039] The processing module is further configured to establish an upper layer Transmission Control Protocol (TCP) connection with the second device based on the first P2P connection and the second P2P connection.

[0040] In the sixth aspect, a networking device is provided, which is applied to a first device in a networking system, and the networking system also includes a second device and a third device, wherein the first device and the second device establish a first point-to-point P2P connection, and the first device is the manager GO role in the group, and the second device is the client GC role in the group; the networking device includes a module / unit for executing the method described in the above third aspect or any possible design of the third aspect.

[0041] Exemplarily, the networking device may include:

[0042] a processing module configured to establish a second P2P connection with a third device; the second P2P connection being established between the third device and the third device based on the first information, the first information being sent to the third device when the third device requests to establish a P2P connection with the second device and the second device confirms that it cannot establish a P2P connection with the third device; the first information being used to instruct the third device to establish the second P2P connection with the first device;

[0043] The processing module is further configured to establish an upper layer Transmission Control Protocol (TCP) connection between the second device and the third device based on the first P2P connection and the second P2P connection when the third device establishes a second P2P connection with the first device based on the first information.

[0044] In a seventh aspect, a networking system is provided, the networking system including a first device, a second device, and a third device, wherein a first point-to-point P2P connection is established between the first device and the second device, and the first device plays the role of a group manager (GO) and the second device plays the role of a group client (GC).

[0045] A second device, configured to perform the method according to the first aspect or any possible design of the first aspect;

[0046] A third device, configured to perform the method according to the aforementioned second aspect or any possible design of the second aspect;

[0047] A first device is used to execute the method in the aforementioned third aspect or any possible design of the third aspect.

[0048] In an eighth aspect, an electronic device is provided, comprising: at least one processor; and a memory and a communication interface communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the at least one processor executes the instructions stored in the memory, so that the electronic device executes the method as described in the first aspect or any possible design of the first aspect, or the method as described in the second aspect or any possible design of the second aspect, or the method as described in the third aspect or any possible design of the third aspect.

[0049] In the ninth aspect, a computer-readable storage medium is provided, comprising a program or instruction, which, when executed on a computer, causes the method as described in the first aspect or any possible design of the first aspect, or the method as described in the second aspect or any possible design of the second aspect, or the method as described in the third aspect or any possible design of the third aspect to be executed.

[0050] In the tenth aspect, a chip is provided, which is coupled to a memory and is used to read and execute program instructions stored in the memory, so that the method in the first aspect or any possible design of the first aspect, or the method in the second aspect or any possible design of the second aspect, or the method in the third aspect or any possible design of the third aspect is executed.

[0051] In the eleventh aspect, a computer program instruction is provided, which, when run on a computer, causes the method of the aforementioned first aspect or any possible design of the first aspect, or the method of the aforementioned second aspect or any possible design of the second aspect, or the method of the aforementioned third aspect or any possible design of the third aspect to be executed. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] Figure 1A flowchart of a method for establishing a P2P connection is shown;

[0053] Figure 2A A schematic diagram of a networking method;

[0054] Figure 2B A schematic diagram of a specific networking method;

[0055] Figure 2C is a schematic diagram of another specific networking method;

[0056] Figure 3 A schematic diagram of the structure of a networking system provided in an embodiment of the present application;

[0057] Figure 4 This is a diagram illustrating the structure of a mobile phone provided in an embodiment of the present application;

[0058] Figure 5A A flowchart of a networking method provided in an embodiment of the present application;

[0059] Figure 5B A schematic diagram of a user graphical interface of the second device 32 provided in an embodiment of the present application;

[0060] Figure 5C A schematic diagram of a user graphical interface of a third device 33 provided in an embodiment of the present application;

[0061] Figure 5D A schematic diagram of a short-range communication scenario provided in an embodiment of the present application;

[0062] Figure 5E A schematic diagram of a user graphical interface of a third device provided in an embodiment of the present application;

[0063] Figure 6 A flowchart of a method for establishing a TCP connection provided in an embodiment of the present application;

[0064] Figure 7A A flowchart of a method for establishing a BLE connection provided in an embodiment of the present application;

[0065] Figure 7B A schematic diagram of a user graphical interface for enabling the BLE function provided in an embodiment of the present application;

[0066] Figure 8 A flowchart of another networking method provided in an embodiment of the present application;

[0067] Figure 9 A schematic diagram of another short-range communication scenario provided in an embodiment of the present application;

[0068] Figure 10A schematic diagram of the structure of a networking device provided in an embodiment of the present application;

[0069] Figure 11 A schematic diagram of the structure of another networking device provided in an embodiment of the present application;

[0070] Figure 12 A schematic diagram of the structure of another networking device provided in an embodiment of the present application;

[0071] Figure 13 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0072] The WiFi Alliance (WFA) has defined WiFi peer-to-peer (P2P) technology for communication between different WiFi devices. This technology, also known as wireless local area network (WLAN) direct connection, allows two or more devices to form a P2P network (also known as a P2P group) and communicate with each other even without a wireless access point (AP). A P2P group can have only one GO device, but can have one or more GC devices.

[0073] The following is a brief introduction to the P2P architecture.

[0074] The P2P architecture defines three components: the P2P device, the P2P government (GO), and the P2P garbage collector (GC). The P2P device is a role entity in the P2P architecture and can be understood as a WiFi device. The GO is a role similar to the data forwarding access point (AP) in the infrastructure basic service set (BSS). Therefore, a GO device can be used for data forwarding. The garbage collector is another role, similar to a station (STA) in an infrastructure BSS. A GC device can be a WiFi-enabled terminal device connected to the wireless network, such as a mobile phone, tablet, or laptop.

[0075] Before forming a P2P Group, each device is a P2P Device. After the P2P Devices complete P2P role negotiation, one of these P2P Devices will play the role of GO (i.e., act as an AP), while the other P2P Devices will play the role of GC (i.e., act as STA).

[0076] For example, assume that a P2P-enabled mobile phone A, a P2P-enabled mobile phone B, and a P2P-enabled TV C negotiate roles, with mobile phone A acting as the GO, mobile phone B as the GC, and TV C as the GC. Mobile phone A then establishes P2P connections with both mobile phone B (which acts as the GC) and TV C (which acts as the GC). These three devices form a P2P group. Mobile phone A can send data to mobile phone B or TV C (for example, sending images displayed on its screen to TV C, which then displays the images). Mobile phone A can also receive data from mobile phone B or TV C, thus enabling screen sharing and resource sharing.

[0077] With P2P technology, different WiFi devices can be directly connected to each other, expanding the use cases of WiFi technology. Applications such as direct connection and wireless display are based on this function.

[0078] P2P groups are divided into two types: permanent groups and temporary groups. The following explains these two types of groups respectively with examples.

[0079] Example 1: Suppose that when a user uses a printer for the first time, a group is established between the user and the printer through a mobile phone with P2P function. During the process of establishing the group, both the mobile phone and the printer save the security configuration information involved (such as keys, authentication methods, etc.) and other information related to the group (such as GO and GC role information). In this group, the devices corresponding to the GO and GC roles are specified during the first P2P connection process, and the devices corresponding to the GO and GC roles remain unchanged during subsequent connections. In this way, the next time the user uses the printer through the mobile phone, the mobile phone can quickly establish a P2P connection based on the previously saved security configuration information and information related to the group. This type of group is called a Persistent Group.

[0080] Example 2: When device A and device B perform a file transfer for the first time, they establish a P2P group through role negotiation. After the transfer is completed, the P2P connection is disconnected. Device A and device B do not save the security configuration information involved in the process of establishing the group, other group-related information, etc. Therefore, when device A and device B perform a file transfer for the second time, they need to perform role negotiation again to establish a new P2P group. During these two role negotiation processes, the role allocation of GO and GC is determined by the intent value and / or the random value breaker carried in the detection frame sent by device A and device B. Therefore, the results of the two role negotiations may be different or the same. This type of group is called a temporary group.

[0081] Figure 1 The following is a flow chart of a method for establishing a P2P connection, which specifically includes the following steps:

[0082] S11. The first device and the second device enable a P2P function.

[0083] For example, assuming that the first device is a mobile phone and the second device is a computer, when the mobile phone receives a first operation (e.g., click) on the P2P function switch of the mobile phone, the P2P function is enabled. The method of enabling the P2P function on the computer can also be similar to the method of enabling the P2P function on the mobile phone.

[0084] S12: The first device and the second device send detection frames to each other.

[0085] After the first device and the second device enable the P2P function, the first device and the second device respectively start scanning for surrounding devices supporting the P2P function. The specific scanning method is not limited. For example, probe (Probe Request) frames can be sent on 2.4GHz bands 1, 6, and 11 respectively.

[0086] S13. The second device sends a response message to the first device.

[0087] During the process of the first device and the second device sending detection frames, the first device and the second device respectively switch to the monitoring state according to the preset rules. If the first device monitors the Probe Request frame sent by the second device on the 11th frequency band, the first device returns a response information to the second device; conversely, if the second device monitors the Probe Request frame sent by the first device on the 11th frequency band, the second device returns a response information to the first device. Figure 1 In the example, the second device returns response information to the first device.

[0088] S14. After receiving the response information, the first device starts the GO negotiation process, determines the GO / GC role, and completes the Group establishment.

[0089] After the first device receives the response message sent by the second device on the preset frequency band, it compares the Intent value carried in the detection frame sent by the first device with the Intent value carried in the response message. If the Intent value carried in the detection frame sent by the first device is larger, the first device is determined to be the GO role and the second device is determined to be the GC role; if the Intent value carried in the response message sent by the second device is larger, the second device is determined to be the GO role and the first device is determined to be the GC role; if the Intent value carried in the detection frame sent by the first device is equal to the Intent value carried in the response message, the GO / GC role is further determined based on the breaker value carried in the detection frame sent by itself and the breaker value carried in the response message. Specifically, if the breaker value carried in the detection frame sent by the first device is 1, the first device is the GO role and the second device is the GC role; if the breaker value in the response message is 1, the second device is determined to be the GO role and the first device is determined to be the GC role.

[0090] S15: The first device and the second device establish a P2P connection.

[0091] After the GO / GC role is determined (ie, Group establishment is completed), the first device and the second device establish a P2P connection according to their respective roles.

[0092] The P2P protocol stipulates that when two devices establish a P2P connection and maintain data communication, the roles of the P2P devices supported by both parties are fixed, and other devices can no longer establish a P2P connection with the GC device. In other words, if other devices want to conduct short-distance communication with the GC device of the two devices that have established a P2P connection, if the GC device does not disconnect the original P2P connection, the other devices will not be able to conduct short-distance communication with the GC device via WiFi.

[0093] For example, see Figure 2A , Figure 2A A schematic diagram of a networking method is shown in Figure 2A In the example, after device I, acting as the GO, and device II, acting as the GC, establish a P2P connection, when device II receives a P2P connection request from device III, it either rejects the request, preventing the two devices from establishing a P2P connection. This prevents short-range communication between devices III and II via WiFi. If device II wishes to establish a P2P connection with device III, it must disconnect from device I.

[0094] It should be understood that the above-mentioned device I, device II or device III can be any terminal device that supports P2P function, such as mobile phones, mobile computers, tablet computers, personal digital assistants (PDAs), media players, smart TVs, smart wearable devices (such as smart watches, smart glasses and smart bracelets), e-readers, handheld game consoles, point of sales (POS), in-vehicle electronic devices (in-vehicle computers), etc.

[0095] Below through Figure 2B 、 Figure 2C Two specific examples are given to further illustrate.

[0096] exist Figure 2B In the example, after the large-screen computer 201 playing the role of GO and the mobile phone 202 playing the role of GC establish a P2P connection, if the mobile phone 203 initiates a P2P connection request to the mobile phone 202, the mobile phone 202 rejects the request.

[0097] exist Figure 2C In the example, after the large-screen computer 201 playing the GO role and the mobile phone 202 playing the GC role establish a P2P connection, if the mobile phone 203 initiates a P2P connection request to the mobile phone 202, the mobile phone 202 disconnects the P2P connection with the large-screen computer 201, and the mobile phone 202 and the large-screen computer 201 exchange the GO / GC roles, that is, the large-screen computer 201 acts as the GC device and the mobile phone 202 acts as the GO device. After that, the large-screen computer 201 and the mobile phone 202 re-establish the P2P connection, and at the same time, the mobile phone 203 establishes a P2P connection with the mobile phone 202 (GO role) in the GC role. In this way, the mobile phones 202 and 203 can communicate over short distances in a WiFi P2P manner.

[0098] However, the P2P connection between the large-screen computer 201 and the mobile phone 202 is disconnected during the role exchange process, which will cause the ongoing business (e.g., screen sharing) between the large-screen computer 201 and the mobile phone 202 to be interrupted, resulting in a poor user experience.

[0099] In view of this, an embodiment of the present application provides a networking communication solution that combines P2P technology with Bluetooth low energy (BLE) technology. After any GC device in the original P2P Group receives a P2P establishment request sent by another device, the GC device can exchange link establishment information with the other device via a BLE connection, thereby controlling the other device to establish a P2P connection with the GO device in the original P2P Group. Furthermore, while maintaining the P2P connection of the original device, the other device can be added to the existing P2P group as a GC. The GO device is used as a data transfer station for data transmission between the other device and the GC device, thereby achieving the technical effect of short-range communication between the other device and the GC device in a WiFi P2P manner. The specific technical solution will be described in detail later.

[0100] The technical solutions of the embodiments of the present application can be applied to various short-range wireless communication systems, such as WiFi P2P communication systems, Bluetooth communication systems or infrared communication systems, etc., which are not specifically limited in this application. The technical solutions of the embodiments of the present application can also be applied to wireless local area networks (WLAN) scenarios, and can be applied to IEEE 802.11 system standards (for example, IEEE 802.11a / n / ac standards, etc.), next-generation WLAN standards (such as 802.11be), or even later-generation standards, and can be applied to wireless local area network systems including but not limited to Internet of Things (IoT) networks or Vehicle to X (V2X) networks. In the following, the application in a WiFi P2P communication system is used as an example for explanation.

[0101] Figure 3 This is a schematic diagram of the structure of a networking system provided in an embodiment of the present application, which includes a first device 31, a second device 32, and a third device 33. The first device 31, the second device 32, and the third device 33 all have short-range wireless communication capabilities. Here, an example is used in which each of the three devices has WiFi P2P capabilities. A P2P connection can be established between any two of the first device 31, the second device 32, and the third device 33. Based on this P2P connection, any two WiFi devices can communicate over short distances in a WiFi P2P manner.

[0102] Figure 3In the example, a P2P connection is established between a first device 31 and a second device 32, where the first device 31 is a GO and the second device 32 is a GC. After the first device 31 and the second device 32 establish a P2P connection, the first device 31 or the second device 32 can receive a P2P connection request from a third device 33 (of course, other types of requests can also be received, such as a Bluetooth connection request).

[0103] It should be understood that the devices included in the actual networking system are not limited to Figure 3 The first device 31, the second device 32 and the third device 33 shown may also include more WiFi devices, or other electronic devices that do not have the WiFi P2P function, which is not limited here.

[0104] The first device 31, the second device 32, and the third device 33 can be any of the following devices: a tablet computer, a laptop computer, a PDA, a mobile internet device (MID), an in-vehicle device, a virtual reality (VR) device, an augmented reality (AR) device, a smart home device, an intelligent robot, etc. As long as they are electronic devices with WiFi P2P functionality, this embodiment of the application is not limited. The structures of the first device 31, the second device 32, and the third device 33 can be the same or different, and are not limited here.

[0105] The following takes the first device 31 , the second device 32 , or the third device 33 as an example, where the first device 31 , the second device 32 , or the third device 33 is a mobile phone.

[0106] See Figure 4 , is a structural diagram of a mobile phone 400 provided in an embodiment of the present application. Figure 4 In the embodiment, the mobile phone 400 includes a communication unit 401, a processing unit 402, a memory unit 403 and a storage unit 404.

[0107] Among them, the communication unit 401 can be one or more devices integrating at least one wireless communication processing module. The communication unit 401 can provide solutions for wireless communications applied to the mobile phone 400, including classic Bluetooth (Classic BT), Bluetooth low energy (BLE), wireless local area networks (WLAN) (such as wireless fidelity (WiFi) networks), near field communication (NFC), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (IR), etc. They have their own advantages, disadvantages and usage scenarios. Among them, key parameters such as comprehensive communication distance (NFC < Classic BT < BLE < WiFi), transmission rate (NFC < BLE < Classic BT < WiFi), throughput (NFC < BLE < Classic BT < WiFi), power consumption (NFC / BLE < Classic BT < WiFi), etc. The technical solutions provided in the embodiments of the present application mainly relate to the BLE module and the WiFi module.

[0108] The processing unit 402 can be a processing unit or a processor integrated by multiple processing units. Among them, different processing units can be independent devices or integrated in one or more processors. The processing unit 402 is used to run the operating system of the mobile phone 400 and multiple upper-layer applications running in the operating system (such as picture library, file management, etc.), and control the execution of application program code to implement the functions of the mobile phone 400 in this embodiment. For example, establish P2P connections, TCP connections or BLE connections with other devices, etc., and transmit data with other devices based on these connections.

[0109] The operating system includes, but is not limited to, any operating system, such as Android, Windows, Linux, Ubuntu, Tizen, etc. The core module involved in the operating system is the management module, which provides a variety of application programming interfaces for interacting with various upper-layer applications. The management module can be further divided into a session management module, an authentication management module, a transmission management module, etc. The management module can also interact with other modules in the mobile phone 400, such as the communication unit 401, the memory unit 403, and the storage unit 404. For example, the session management module in the processing unit 402 can also schedule the BLE module in the communication unit 401 to establish a BLE connection between the mobile phone 400 and other devices, or schedule the WiFi module in the communication unit 401 to establish a TCP connection between the mobile phone 400 and other devices. For another example, the transmission management module of the mobile phone 400 can read file data in the local storage unit 404 and send the file to other devices that have established a TCP connection with the mobile phone 400.

[0110] In some embodiments, the processing unit 402 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface.

[0111] The memory unit 403 is used to store instructions and data. In some embodiments, the memory in the memory unit 403 is a cache memory. The memory can save instructions or data that the processing unit 402 has just used or circulated. If the processing unit 402 needs to use the instruction or data again, it can be directly called from the memory. Repeated access is avoided, the waiting time of the processing unit 402 is reduced, and the efficiency of the system is improved. For example, the processing unit 402 can save the role information and security configuration information involved in the process of establishing a P2P connection between the mobile phone 400 and a device 1 in the memory unit 403. If the mobile phone 400 needs to establish a P2P connection with the device 1 again, the processing unit 402 can directly call the role information, security configuration information, etc. from the memory unit 403, and the mobile phone 400 and the device 1 can establish a P2P connection based on the retrieved information.

[0112] The storage unit 404 can be provided with an external memory interface and an internal memory interface, wherein the external memory interface can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the mobile phone 400. The external memory card communicates with the processing unit 402 via the external memory interface to implement a data storage function. For example, files such as music and videos can be stored in the external memory card. For another example, during the process of establishing a BLE connection between the mobile phone 400 and other devices 2, the authentication management module in the processing unit 402 can authenticate and authenticate information such as the security key of the device 2 to obtain an authentication result, and store the authentication result in the storage unit 404. The next time the mobile phone 400 establishes a BLE connection with the device 2 again, the processing unit 402 can directly obtain the authentication result from the storage unit 404, and there is no need for the authentication management module in the processing unit 402 to authenticate the device 2 again.

[0113] It should be understood that the structures illustrated in the embodiments of the present application do not constitute a specific limitation on mobile phone 400. In other embodiments of the present application, mobile phone 400 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0114] It should be understood that the terms "system" and "network" in the embodiments of the present application can be used interchangeably. "At least one" refers to one or more, and "plurality" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can represent: a, or b, or c, or a and b, or b and c, or a and c, or a and b and c.

[0115] Furthermore, unless otherwise indicated, ordinal numbers such as "first" and "second" in the embodiments of this application are used to distinguish between multiple objects and are not used to define the order, timing, priority, or importance of multiple objects. For example, the first priority criterion and the second priority criterion are only used to distinguish different criteria and do not indicate differences in the content, priority, or importance of the two criteria.

[0116] like Figure 5A FIG. 1 is a flow chart of a networking method provided in an embodiment of the present application, wherein the method is applied to Figure 3 Taking the networking system shown in the figure as an example, the method mainly includes the following steps:

[0117] S501: The first device 31 and the second device 32 establish a P2P connection.

[0118] Specifically, after the first device 31 and the second device 32 turn on the WIFI P2P function, a role negotiation process is first performed. For example, the second device 32 sends a P2P connection request to the first device 31. The first device 31 receives the P2P connection request and determines the roles of the first device 31 and the second device 32 according to preset rules (for example, the size of the Intent value and the breaker value). For example, the second device 32 is the GC role and the first device 31 is the GO role, and sends the negotiated role information to the second device 32. After receiving the role information, the second device 32 determines that it is the GC role.

[0119] It is understandable that when the first device 31 and the second device 32 are negotiating roles, the first device 31 allocates IP addresses for establishing a P2P connection to the P2P GO device (i.e., the first device 31) and the P2P GC device (i.e., the second device 32), and creates a P2P interface address for the P2P GO device (i.e., the first device 31). The first device 31 and the second device 32 use this P2P interface address as the MAC address and basic service set identifier (BSSID) of the P2P connection. The first device 31 selects an operating channel, sends probe frames and probe response frames on the operating channel, and continuously sends beacon frames to broadcast the timing synchronization function (TSF) and required operating parameters to clarify the capabilities of the GO device and GC device and the services they can provide.

[0120] Furthermore, the first device 31 and the second device 32 negotiate the key through the push button configuration (PBC) method in the Wi-Fi access technology (wifi protected setup, WPS), obtain the pairwise master key (PMK) and the pairwise transient key (PTK), and encrypt data transmission according to the PTK and GTK.

[0121] Alternatively, the role negotiation process can involve first device 31 sending a P2P connection request to second device 32. Upon receiving the P2P connection request, second device 32 determines the roles of first device 31 and second device 32 based on predefined rules and sends the role information to first device 31. Upon receiving the role information, first device 31 determines itself as the GO. Subsequently, a P2P connection is established between first device 31 and second device 32, which plays the GC role.

[0122] In some possible embodiments, the second device 32 and the first device 31 may have established a P2P connection in advance, and the role information of the last P2P connection is saved in both the second device 32 and the first device 31 (the first device 31 is the GO role, and the second device 32 is the GC role). Then, when the second device 32 and the first device 31 need to establish a P2P connection again, the first device 31 can directly generate a QR code carrying the P2P connection role negotiation information. The second device 32 only needs to scan the QR code to obtain the role information and further automatically establish a P2P connection with the first device 31 playing the GO role in the role of GC. No role negotiation is required, which can greatly improve the efficiency of establishing the P2P connection.

[0123] It is understandable that before the first device 31 and the second device 32 establish a P2P connection, the first device 31 and the second device 32 need to receive user operations to turn on the Wi-Fi P2P function. The first device and the second device need to be in the Wi-Fi P2P scanning state. At this time, both devices enable the Wi-Fi P2P capability and broadcast signals to the surrounding area to indicate that they can be discovered. For example, taking the second device 32 as an example, see Figure 5B 、 5C If the user needs to enable the Wi-Fi P2P function of the second device 32, the user can click the WLAN menu drop-down function button through the setting interface of the second device 32 to enter the WLAN drop-down selection menu. The second device 32 continues to detect that the user has clicked the menu drop-down function button for more WLAN settings, and displays various connection methods supported by WLAN (WLAN direct connection, WPS connection, etc.); when a touch or click action is detected for the menu drop-down function button for WLAN direct connection, the WiFi P2P function of the second device 32 is enabled; the second device 32 starts scanning for available devices, such as Figure 5B As shown in FIG, the available device list includes the first device 31, the third device 33, and the fourth device; if the user wants to control the second device 32 to stop scanning devices, click the stop button 501. When the second device 32 detects the user's click operation on the name of the first device 31, it starts to negotiate the role with the first device 31, and after the P2P connection is established, the following information is displayed below the notification bar of the second device 32: Figure 5C The prompt box 502 shown is used to prompt the user that the second device 32 is directly connected to the first device 31 via WLAN.

[0124] S502 : The third device 33 sends a P2P establishment request to the second device, and the second device 32 receives the P2P establishment request from the third device 33 .

[0125] After the second device 32 receives the P2P establishment request from the third device 33, it queries the link establishment information of the second device 32 (for example, P2P port information) and finds that it has established a P2P connection with the first device 31 playing the GO role in the GC role, and can no longer establish a P2P connection with the third device 33 (negotiation role), then executes step S503A.

[0126] In one possible design, the P2P connection request sent by the third device 33 may also carry link establishment information of the third device 33. The link establishment information may include: WiFi channel, media access control (MAC) address, P2P port, service set identifier (SSID), authentication method, key, Internet protocol (IP) address, and other information.

[0127] In another possible design, the P2P connection request sent by the third device 33 may not carry the link establishment information of the third device 33. Instead, the third device 33 encapsulates the link establishment information of the third device 33 into a short message and sends the short message to the second device 32 via Bluetooth, where Bluetooth can be Classic BT or BLE, which is not specifically limited in the embodiments of the present application.

[0128] Optionally, after receiving the link establishment information from the third device, the second device 32 first determines whether the P2P port of the third device 33 is available. If it is available, step S503A is performed. If it is not available, S505A can be directly executed, and the second device 32 sends a rejection message to the third device 33.

[0129] S503A: The second device 32 sends a query message to the first device 31 . The query message is used to inquire whether the first device 31 can add a new GC device.

[0130] S503B: The first device 31 returns response information to the second device 32. The response information indicates whether the first device 31 (GO device) can join the new GC device.

[0131] S504: The second device 32 receives the response information and determines whether the first device 31 can add a new GC device based on the response information. If yes, execute S505B; otherwise, execute S505A.

[0132] In one possible embodiment, the second device 32 may send a TCP query message to the first device 31 to query whether the first device 31 has an available port and an assignable IP address. After receiving the TCP query message, the first device 31 returns a response message to the second device 32. If the second device 32 determines, based on the response message, that the GO device cannot access the new GC device, step S505A is executed. If the second device 32 determines, based on the response message, that the GO device can access the new GC device, step S505B is executed.

[0133] S505A: The second device 32 sends a rejection message to the third device 33.

[0134] Exemplarily, the rejection information may be a prompt message of “unable to establish P2P connection” fed back by the second device 32 to the third device 33 .

[0135] Alternatively, the second device 32 may not send a rejection message to the third device 33. After the second device 32 sends a P2P establishment request to the third device 33, if no return message is received from the second device 32 after a preset time, it is assumed that the second device 32 has rejected the P2P establishment request of the third device 33.

[0136] S505B: The second device 32 sends the first information to the third device 33.

[0137] S506: The third device 33 establishes a P2P connection with the first device 31 based on the first information.

[0138] There are multiple ways to implement the first information.

[0139] In a first possible design, the first message includes information about the GO device (i.e., the first device 31), the port information and IP address assigned by the first device 31 to the third device 33, and the port information and IP address of the second device 32. After receiving the first message, the third device 33 directly establishes a P2P connection based on the port information and IP address assigned by the first device 31 to the third device 33. The third device 33 then quickly establishes a P2P connection with the first device 31 in the GC role.

[0140] Optionally, before executing S506, the third device 33 can disconnect the BLE connection with the second device 32 to create a P2P interface and configure the IP address assigned to it by the first device 31 on the interface. The third device 33 establishes a P2P connection with the GO device, i.e., the first device 31, in the role of GC based on the IP address and port assigned to it by the first device 31 and its own available IP address and port.

[0141] In the second possible design, the first information includes the device information of the GO, the port information and the IP address of the second device 32. Then, after receiving the first information, the third device 33 first sends a request to the first device 31 to establish a P2P connection based on the first information. The request to establish a P2P connection can carry the link establishment information of the third device 33. After receiving the request, the first device 31 returns the P2P port and IP address allocated by the first device 31 to the third device 33 to the third device 33. Then, the third device 33 quickly establishes a P2P connection with the first device 31 in the GC role based on the P2P port and IP address.

[0142] S507: The second device 32 and the third device 33 establish a TCP connection.

[0143] After the third device 33 establishes a P2P connection with the first device 31 (i.e., GO device) in the GC role, the second device 32 can establish a TCP connection with the third device 33. Afterwards, the second device 32 and the third device 33 can communicate data using the first device 31 as a data transfer station.

[0144] The specific process of establishing an upper-layer TCP connection between the second device 32 and the third device 33 is as follows:

[0145] The third device 33 sends a request message to the first device 33 for requesting to establish a TCP connection with the second device, and carries the first TCP port used by the third device 31 to establish a TCP connection in the request message; the first device 31 receives the request message and forwards the request message to the second device 32; the second device 32 receives the request message and, in response to the request message, sends a reply message to the first device 31, which carries the second TCP port used by the second device 32 to establish a TCP connection; the first device 31 receives the reply message and forwards the message to the third device 33; the third device 33 receives the reply message and establishes a TCP connection with the second device based on the first TCP port and the second TCP port.

[0146] In the above process, the first device 31 acts as a data transfer station and completes the data interaction between the third device 33 and the second device 32 by establishing a TCP connection.

[0147] Through the networking method provided in the embodiment of the present application, the third device 33 can establish a P2P connection with the first device 31 (GO device) in the GC role while the P2P connection established between the second device 32 and the first device 31 is not disconnected, thereby enabling the second device 32 and the third device 33 to establish a TCP connection and transmit data to each other with the first device 31 as a transfer station, thereby enabling the second device 32 and the third device 33 to communicate over short distances in the manner of WiFi P2P. Furthermore, the second device 32 (GC role) can simultaneously communicate over short distances with the original first device 31 (GO role) and the newly added third device 33 (GC role) in the manner of WiFi P2P.

[0148] For example, see Figure 5D , while the second device 32 shares the screen with the first device 31 , it can also share files with the third device 33 . Figure 5D The transmission path of the shared file marked by the dotted line is the transmission path seen by the user, and the actual transmission path is the data transmission path of the shared file marked by the solid line.

[0149] It is understandable that when the user shares a picture with the second device 32 via the third device 33 , when the user clicks the WLAN direct connection function button, the third device 33 may also be triggered to initiate a P2P connection request to the second device 32 .

[0150] For example, see Figure 5E After the third device 33 detects that the user has selected a target picture (i.e., the picture to be transferred) from the photo album application and detects a click operation on the sharing control 504 in the interface 500, an interface 510 is displayed. The interface 510 displays a variety of methods that can be used for data transmission, such as Bluetooth 511, information 512, WLAN 513, etc. The third device 33 further detects a click or touch operation on the WLAN 513 and displays an interface 520.

[0151] In the interface 520, the WLAN direct connection function is turned on and the surrounding available devices are scanned. If the third device 33 detects a click operation on the second device 32 identifier, the second device is determined as the target device, a P2P connection request is sent to the second device 32, the information returned by the second device 32 is received, and a P2P connection is established with the first device 31 based on the indication information. After that, a prompt box 532 indicating that the third device 33 has been directly connected to the first device WLAN is displayed under the notification bar, and a prompt message 533 indicating that a picture is being sent to the second device 32 and a prompt message 534 reminding the user to cancel sending the picture are displayed.

[0152] During the image transmission process shown in interface 530, a prompt box 541 for WiFi P2P transmission may be displayed all the time, in which the image transmission progress 543 and the transmission task (for example, sending 20 images to the second device 32542) may be displayed; after the third device 33 detects that the transmission task is completed, an interface 550 is displayed, in which a prompt box 551 for WiFi P2P transmission is displayed, and a prompt message 552 is displayed in the prompt box 551 to inform the user that the transmission task has been completed (for example, 20 images were successfully transmitted and 0 images failed).

[0153] It should be understood that the TCP connection request in the above process can be initiated by the third device 33 or the second device 32, and this application does not limit this. Figure 6 , the following takes the third device 33 sending a TCP establishment request to the second device 32 as an example Figure 6 , which details the process of establishing a TCP connection, including the following steps:

[0154] S601 : The third device 33 sends a TCP establishment request message to the second device 32 through the first device 31 .

[0155] In a possible embodiment, before sending a TCP establishment request, the third device 33 needs to determine whether its address is a public network address, or determine whether it uses a sock5 proxy based on the recorded software setting file (such as a configuration file); if it is a public network address or a proxy server sock5 proxy is used, a TCP connection request message is sent to the second device 32, and the public IP address and public TCP port of the third device 33 are carried in the designated address of the request message; if it is neither a public network address nor a sock5 proxy is used, the request message sent by the third device 33 to the second device 32 carries a designated address with both IP and TCP port 0 to tell the second device 32 that the third device 33 is in the same network as it.

[0156] Among them, the third device 33 determines that the IP address of the third device 33 is a public network address by determining that the IP address of the third device 33 does not belong to a private network address (for example, within the range of 192.168.*.*, 10.1.*.*, 172.(16-31).*.*, etc.).

[0157] S602: The second device 32 determines that the IP and TCP port fields in the specified address in the request message are 0.

[0158] Specifically, if the IP and TCP port fields in the specified address in the request message are both 0, step S603 is executed; if the IP and TCP port fields in the specified address in the request message are not 0, the second device 32 directly uses the TCP protocol to connect to the public IP address and public TCP port in the specified address carried by the request message, and establishes a TCP connection from the second device 32 to the third device 33.

[0159] S603: The second device 32 determines whether it is on the public network or whether it uses a sock5 proxy.

[0160] Specifically, if the second device 32 is on the public network or uses a sock5 proxy, step S604 is executed; after receiving the message, the third device 33 directly uses the TCP protocol to connect to the public IP address and public TCP port of the second device 32, establishing a TCP connection from the third device 33 to the second device 32. If the address of the second device is neither a public network address nor a sock5 proxy is used, step S605 is executed to send a connection failure message to the third device 33.

[0161] S604 : The second device 32 sends a message carrying a designated address to the third device 33 through the first device 31 . The designated address includes the public IP address and public TCP port of the second device 32 .

[0162] S605 : The second device 32 sends connection failure information to the third device 33 through the first device 31 .

[0163] Optionally, the connection failure information is used to instruct the third device 33 to re-initiate a TCP connection request.

[0164] See Figure 7A Taking BLE as an example, the following describes the process of the third device 33 sending link establishment information to the second device 32 via Bluetooth, which specifically includes the following steps:

[0165] S701 : The third device 33 performs a BLE broadcast, broadcasting a first message, where the first message carries the account information of the third device 33 .

[0166] Specifically, the third device 33 turns on the BLE function, sets the BLE of the third device 33 to a discoverable mode, and sends a BLE broadcast message to the second device 32 .

[0167] For example, see Figure 7B As shown, the user can swipe downward from the top of the display screen of the third device 33, and the electronic device can respond to the user's swiping operation by displaying a notification bar, and the user can click the Bluetooth icon 503 in the notification bar to turn on the BLE function of the third device 33. Of course, it is understandable that there are many ways to turn on BLE, for example, the user can also turn on the BLE function through voice commands (such as "turn on the BLE function"), or through quick gesture operations (such as swiping up with three fingers, etc.), and this application does not limit this.

[0168] S702 : The second device 32 performs a BLE scan and receives a first message broadcast by the third device 33 .

[0169] Specifically, the second device 32 activates the BLE function and performs a BLE scan. When the first message broadcast by the third device 33 is scanned, step S703 is executed. The process of activating the BLE function of the second device 32 is described in detail in the description of activating the BLE function of the third device 33, which will not be repeated here.

[0170] S703: The second device 32 parses the first message.

[0171] Specifically, the second device 32 obtains the account information (eg, device identification) of the target device (ie, the third device 33 ) by parsing the obtained BLE broadcast message.

[0172] In some possible embodiments, the second device 32 parses the first message. If it is found that the third device 33 needs to authenticate the second device 32, the second device 32 sends an authentication request to the third device 33 to obtain the authentication result of the third device 33 authenticating the second device 32. If the authentication result shows that the authentication is successful, the second device 32 determines that the third device 33 is the target device of this BLE connection and executes step 704; otherwise, the second device 32 determines that the authentication fails and displays a prompt message that the BLE connection fails.

[0173] S704: The second device 32 and the third device 33 establish a BLE connection.

[0174] S705 . The third device 33 sends a second message to the second device 32 through the BLE connection. The second message carries the link establishment information of the third device 33 .

[0175] like Figure 8 As shown, Figure 8 A flowchart of another networking method provided in an embodiment of the present application. Figure 8 The networking method provided is Figure 5A The difference between the provided networking methods is that after the first device 31 and the second device 32 establish a P2P connection as a GO role and a GC role respectively, Figure 5A In the figure, the second device 32 playing the role of GC receives the P2P connection request from the third device 33. Figure 8 In the figure, the first device 31 playing the role of GO receives a P2P connection request from the third device 33.

[0176] S801: The first device 31 and the second device 32 establish a P2P connection.

[0177] The second device 32 plays the role of GC, and the first device 31 plays the role of GO. For specific implementation, please refer to the description of S501 above.

[0178] S802 : The third device 33 sends a P2P connection request to the first device 31 , and the first device 31 receives the P2P connection request from the third device 33 .

[0179] Specific implementation method: Please refer to the specific implementation method of the third device 33 sending the P2P connection request to the second device 32 in S502 above, which will not be repeated here.

[0180] S803: The first device 31 determines that it is a GO device and has an available P2P port, and then the first device 31 establishes a P2P connection with the third device 33.

[0181] Optionally, the first device 31 and the third device 33 may further establish a TCP connection, and then the first device 31 and the third device 33 transmit data to each other through the TCP connection.

[0182] Optionally, in S804 , the first device 31 sends link establishment information of the second device 32 to the third device 33 .

[0183] After receiving the link establishment information from the second device 32 , the third device 33 learns that the second device is a GC device, and then may further send a request message for establishing a TCP connection to the second device 32 .

[0184] Optionally, in S805 , the third device 33 and the second device 32 establish a TCP connection, and the second device 32 and the third device 33 transmit data to each other through the first device 31 .

[0185] From the above description, we can see that Figure 8 In the provided networking method, when the first device 31 (GO device) receives a P2P connection request from the third device 33, the third device 33 can establish a P2P connection with the first device 31 in the role of GC. After the third device 33 and the first device 31 establish a P2P connection, the first device 31 can also send the link establishment information of the second device 32 (original GC device) to the third device 33, so that the third device 33 and the second device 32 (original GC device) can establish a TCP connection and transmit data to each other based on the TCP connection, so that the second device 32 (original GC device) can simultaneously communicate with multiple devices over short distances in a WiFi P2P manner.

[0186] Of course, when the third device 33 is added Figure 3 After the P2P Group shown (the P2P Group composed of the first device 31 and the second device 32), other devices such as the fourth device 34 can also join the P2P Group (the P2P Group composed of the first device 31, the second device 32 and the third device 33). The method for the fourth device 34 to join the P2P Group is similar to the method for the third device 34 to join the P2P Group.

[0187] For example, see Figure 9 , when executing the above Figure 5A After the method, the networking system includes three devices: the first device 31, the second device 32, and the third device 33. The first device 31 is a GO device, the second device 32, and the third device 33 are GC devices. Afterwards, the fourth device 34 sends a P2P connection request to the third device 33. The third device 33 (GC role) controls the fourth device 34 (in the GC role) to establish a P2P connection with the first device 31 (GO role). For specific implementation methods, please refer to Figure 5AThe process shown here will not be repeated here. Then, the third device 33 and the fourth device 34 can establish a TCP connection and transmit data to each other. In this way, without interrupting the P2P connection between the third device 33 and the first device 31, data communication between the fourth device 34 and the third device 33 is achieved in a WiFi P2P manner, better meeting the user's needs for efficient short-distance communication using multiple devices.

[0188] Combination of the above Figure 5A 、 Figure 6 、 Figure 7A 、 Figure 8 This paper introduces the networking method provided by the embodiment of the present application. Figure 10 、 Figure 11 、 Figure 12 The device provided in the embodiments of the present application is introduced.

[0189] Based on the same technical concept, the embodiment of the present application also provides a networking device 1000, which has the function of realizing the above Figure 5A 、 Figure 6 、 Figure 7A or Figure 8 The functions of the second device 32 in the embodiment shown, for example, the apparatus 1000 includes executing the above Figure 5A The modules, units, or means corresponding to the steps executed by the second device 32 in the illustrated embodiment may be implemented by software, hardware, or by executing corresponding software implementations through hardware.

[0190] For example, see Figure 10 , the apparatus 1000 may include:

[0191] The communication module 1001 is configured to receive a first P2P connection request from a third device;

[0192] The communication module 1001 is further configured to, upon determining that the third device cannot establish a P2P connection with the third device, return first information to the third device, so that the third device establishes a second P2P connection with the first device according to the first information;

[0193] The processing module 1002 is configured to establish an upper layer Transmission Control Protocol (TCP) connection with the third device based on the first P2P connection and the second P2P connection after the third device establishes the second P2P connection with the first device.

[0194] In one possible design, after the processing module 1002 determines that the second device cannot establish a P2P connection with the third device, before the communication module 1001 returns the first information to the third device, the communication module 1001 is also used to: send a query request to the first device, and receive a first response message from the first device; wherein the query request is used to query whether the first device is allowed to access a new GC device, and the first response message is used to indicate that the first device is allowed to access a new GC device.

[0195] In one possible design, the first information includes: link establishment information of the first device.

[0196] In one possible design, the first information includes: link establishment information of the first device, the P2P port and IP address allocated by the first device to the third device.

[0197] In one possible design, the first P2P connection request carries link establishment information of the third device; after the communication module 1001 receives the first P2P connection request and before sending a query request to the first device, the processing module 1002 is further used to: determine whether the P2P port of the third device is available based on the link establishment information of the third device.

[0198] In one possible design, after receiving the first P2P connection request and before sending a query request to the first device, the communication module 1001 is further used to: send a low-power Bluetooth BLE connection request to a third device; receive a third response message from the third device, the third response message being used to indicate that the third device agrees to establish a BLE connection with the second device; establish a BLE connection with the third device, and receive third information from the third device through the BLE connection, the third information carrying link establishment information of the third device; the processing module 1002 is further used to determine, based on the link establishment information of the third device, that the P2P port of the third device is available.

[0199] In one possible design, the processing module 1002 is used to establish an upper-layer Transmission Control Protocol TCP connection between the third device and the first device based on the first P2P connection and the second P2P connection after the third device establishes a second P2P connection. It is specifically used to: control the communication module 1001 to receive the request information forwarded by the first device, where the request information is information used by the third device to request to establish a TCP connection with the second device, and the request information carries the first TCP port used by the third device to establish the TCP connection; control the communication module 1001 to send a fourth response message to the third device through the first device in response to the request information, where the fourth response message carries the second TCP port used by the second device to establish the TCP connection.

[0200] It should be understood that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module and will not be repeated here.

[0201] Based on the same technical concept, the embodiment of the present application also provides a networking device 1100, which has the function of realizing the above Figure 5A 、 Figure 6 、 Figure 7A or Figure 8 The functions of the third device 33 in the embodiment shown are, for example, the device 1100 includes executing the above Figure 5A The modules, units, or means corresponding to the steps executed by the third device 33 in the illustrated embodiment may be implemented by software, hardware, or by executing corresponding software implementations through hardware.

[0202] For example, see Figure 11 , the apparatus 1100 may include:

[0203] The communication module 1101 is configured to send a first P2P connection request to the second device;

[0204] The communication module 1101 is further configured to receive first information from the second device, where the first information is sent by the second device when the second device cannot establish a P2P connection with the third device; the first information is used to instruct the third device to establish a second P2P connection with the first device;

[0205] A processing module 1102 is configured to establish a second P2P connection with the first device according to the first information;

[0206] The processing module 1102 is further configured to establish an upper layer Transmission Control Protocol (TCP) connection with the second device based on the first P2P connection and the second P2P connection.

[0207] In one possible design, the first information includes: link establishment information of the first device; when the processing module 1102 is used to establish a second P2P connection with the first device based on the first information, it is specifically used to: control the communication module 1101 to send a second P2P establishment request to the first device; control the communication module 1101 to receive a second response message from the first device, the second response message carries the P2P port and IP address allocated by the first device to the third device; based on the P2P port and IP address, establish a P2P connection with the first device in the GC role.

[0208] In one possible design, the first information includes: link establishment information of the first device, the P2P port and IP address allocated by the first device to the third device; when the processing module 1102 is used to establish a second P2P connection with the first device based on the first information, it is specifically used to: establish a second P2P connection with the first device in the GC role based on the P2P port and IP address.

[0209] In one possible design, the first P2P connection request carries link establishment information of the third device.

[0210] In one possible design, after being used to send a first P2P connection request to the second device, the communication module 1101 is also used to: receive a BLE connection request from the second device; send a third response message to the second device, the third response message being used to indicate that the third device agrees to establish a BLE connection with the second device, so that the second device and the third device establish a BLE connection; send third information to the second device via the BLE connection, the third information carrying link establishment information of the third device, and the link establishment information of the third device being used to indicate that the P2P port of the third device is available.

[0211] In one possible design, the processing module 1102 is used to establish an upper-layer Transmission Control Protocol TCP connection with the second device based on the first P2P connection and the second P2P connection, and is specifically used to: control the communication module 1201 to send a request message to the second device through the first device, the request message is used to request to establish a TCP connection with the second device, and the request message carries the first TCP port used by the third device to establish the TCP connection; control the communication module 1201 to receive a fourth response message from the second device through the first device, and the fourth response message carries the second TCP port used by the second device to establish the TCP connection; and establish a TCP connection with the second device based on the first TCP port and the second TCP port.

[0212] Based on the same technical concept, the embodiment of the present application also provides a networking device 1200, which has the function of realizing the above Figure 5A 、 Figure 6 or Figure 8 In the embodiment shown, the first device 31 functions as follows. For example, the device 1200 includes the following: Figure 5A The modules, units, or means corresponding to the steps executed by the first device 31 in the illustrated embodiment may be implemented by software, hardware, or by executing corresponding software implementations through hardware.

[0213] For example, see Figure 12 , the apparatus 1200 may include:

[0214] Processing module 1201 is configured to establish a second P2P connection with the third device; the second P2P connection is established between the third device and the third device based on first information, wherein the first information is sent to the third device when the third device requests to establish a P2P connection with the second device and the second device confirms that a P2P connection cannot be established with the third device; the first information is used to instruct the third device to establish the second P2P connection with the first device;

[0215] The processing module 1201 is further configured to establish an upper layer Transmission Control Protocol (TCP) connection between the second device and the third device based on the first P2P connection and the second P2P connection when the third device establishes a second P2P connection with the first device based on the first information.

[0216] In one possible design, before establishing a second P2P connection with a third device, the networking device 1200 also includes a communication module 1202, which is used to: receive a query request from the second device, and send a first response message to the second device in response to the query request; wherein the query request is used to query whether the first device is allowed to access a new GC device, and the first response message is used to indicate that the first device is allowed to access a new GC device.

[0217] In one possible design, processing module 1201 is configured to establish a second P2P connection with a third device, specifically to:

[0218] Receive a second P2P establishment request from a third device; and in response to the second P2P establishment request, send a second response message to the third device, where the second response message carries the P2P port and IP address allocated by the first device to the third device.

[0219] In one possible design, when the processing module 1201 is used to establish an upper-layer TCP connection between the second device and the third device based on the first P2P connection and the second P2P connection, it is specifically used to: control the communication module 1202 to receive request information from the third device through the second P2P connection, and forward the request information to the second device through the first P2P connection; the request information is used to indicate that the third device requests to establish a TCP connection with the second device, and the request information carries the first TCP port used by the third device to establish the TCP connection; control the communication module 1202 to receive a fourth response message from the second device through the first P2P connection, and the fourth response message carries the second TCP port used by the second device to establish the TCP connection; forward the fourth response message to the third device through the second P2P connection.

[0220] Based on the same technical concept, the embodiment of the present application also provides a computer-readable storage medium, including a program or instruction, which, when executed on a computer, enables Figure 5A 、 Figure 6 、 Figure 7A or Figure 8 The method performed by the second device 32 in the illustrated embodiment is executed.

[0221] Based on the same technical concept, the embodiment of the present application also provides a computer-readable storage medium, including a program or instruction, which, when executed on a computer, enables Figure 5A 、 Figure 6 、 Figure 7A or Figure 8 The method performed by the third device 33 in the illustrated embodiment is executed.

[0222] Based on the same technical concept, the embodiment of the present application also provides a computer-readable storage medium, including a program or instruction, which, when executed on a computer, enables Figure 5A 、 Figure 6 、 Figure 7A or Figure 8 The method performed by the first device 31 in the illustrated embodiment is executed.

[0223] Based on the same technical concept, the embodiment of the present application further provides a chip, which is coupled to a memory and is used to read and execute program instructions stored in the memory, so that Figure 5A 、 Figure 6 、 Figure 7A or Figure 8 The method performed by the second device 32 in the illustrated embodiment is executed.

[0224] Based on the same technical concept, the embodiment of the present application further provides a chip, which is coupled to a memory and is used to read and execute program instructions stored in the memory, so that Figure 5A 、 Figure 6 、 Figure 7A or Figure 8 The method performed by the third device 33 in the illustrated embodiment is executed.

[0225] Based on the same technical concept, the embodiment of the present application further provides a chip, which is coupled to a memory and is used to read and execute program instructions stored in the memory, so that Figure 5A 、 Figure 6 、 Figure 7A or Figure 8 The method performed by the first device 31 in the illustrated embodiment is executed.

[0226] Based on the same technical concept, the embodiment of the present application also provides a computer program instruction, which, when executed on a computer, enables Figure 5A 、 Figure 6 、 Figure 7A or Figure 8 The method performed by the second device 32 in the illustrated embodiment is executed.

[0227] Based on the same technical concept, the embodiment of the present application also provides a computer program instruction, which, when executed on a computer, enables Figure 5A 、 Figure 6 、 Figure 7A or Figure 8 The method performed by the third device 33 in the illustrated embodiment is executed.

[0228] Based on the same technical concept, the embodiment of the present application also provides a computer program instruction, which, when executed on a computer, enables Figure 5A 、 Figure 6 、 Figure 7A or Figure 8 The method performed by the first device 31 in the illustrated embodiment is executed.

[0229] The above embodiments can be combined with each other to achieve different technical effects.

[0230] Based on the same technical concept, the embodiment of the present application also provides an electronic device 1300 for implementing Figure 5A 、 Figure 6 、 Figure 7A or Figure 8 The method in the embodiment shown.

[0231] like Figure 13 As shown, the electronic device 1300 may include a processor 1301 for executing a program or instruction stored in a memory 1302. When the program or instruction stored in the memory 1302 is executed, the processor is used to execute Figures 4 to 6 The method in the embodiment shown.

[0232] Optionally, the electronic device 1300 may further include a communication interface 1303. Figure 13 The dashed lines indicate that the communication interface 1303 is optional for the electronic device 1300 .

[0233] The number of processors 1301, memories 1302, and communication interfaces 1303 does not constitute a limitation on the embodiments of the present application, and can be arbitrarily configured according to business requirements during specific implementation.

[0234] Optionally, the memory 1302 is located outside the electronic device 1300 .

[0235] Optionally, the electronic device 1300 includes the memory 1302, the memory 1302 is connected to the at least one processor 1301, and the memory 1302 stores instructions that can be executed by the at least one processor 1301. Figure 13 The dashed lines indicate that the memory 1302 is optional for the electronic device 1300 .

[0236] The processor 1301 and the memory 1302 may be coupled via an interface circuit or may be integrated together, which is not limited here.

[0237] The specific connection medium between the processor 1301, the memory 1302 and the communication interface 1303 is not limited in the embodiment of the present application. Figure 13 The processor 1301, the memory 1302 and the communication interface 1303 are connected via a bus 1304. Figure 13 The connections between the other components are shown in bold lines, which are only for illustration and are not intended to be limiting. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, Figure 13 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.

[0238] It should be understood that the processors mentioned in the embodiments of the present application can be implemented by hardware or software. When implemented by hardware, the processor can be a logic circuit, an integrated circuit, etc. When implemented by software, the processor can be a general-purpose processor that is implemented by reading software code stored in a memory.

[0239] Exemplarily, the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.

[0240] It should be understood that the memory mentioned in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct RAM bus random access memory (DR RAM).

[0241] It should be noted that when the processor is a general-purpose processor, DSP, ASIC, FPGA or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, the memory (storage module) can be integrated into the processor.

[0242] It should be noted that the memory described herein is intended to include, but not be limited to, these and any other suitable types of memory.

[0243] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0244] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0245] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0246] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0247] Obviously, those skilled in the art can make various changes and modifications to the embodiments of the present application without departing from the scope of the embodiments of the present application. Thus, if these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalents, the present application also intends to include these modifications and variations.

Claims

1. A networking method, characterized in that: The method is applied to a second device, where a first P2P connection is established between the second device and the first device, the first device plays the role of a group manager (GO), and the second device plays the role of a group client (GC). The method includes: receiving a first P2P connection request from a third device; When determining that the third device cannot establish a P2P connection with the third device, returning first information to the third device, where the first information is used to instruct the third device to establish a second P2P connection with the first device; After the third device establishes the second P2P connection with the first device, an upper layer Transmission Control Protocol (TCP) connection is established with the third device based on the first P2P connection and the second P2P connection.

2. The method according to claim 1, wherein After determining that the P2P connection cannot be established with the third device, and before returning the first information to the third device, the method further includes: A query request is sent to the first device, and a first response message is received from the first device; wherein the query request is used to query whether the first device allows access to a new GC device, and the first response message is used to indicate that the first device allows access to a new GC device.

3. The method according to claim 1 or 2, wherein: The first information includes: link establishment information of the first device.

4. The method according to claim 1 or 2, wherein: The first information includes: link establishment information of the first device, and a P2P port and an IP address allocated by the first device to the third device.

5. The method according to claim 2, wherein The first P2P connection request carries the link establishment information of the third device; after receiving the first P2P connection request and before sending the query request to the first device, the method further includes: It is determined, according to the link establishment information of the third device, that the P2P port of the third device is available.

6. The method according to claim 2, wherein After receiving the first P2P connection request and before sending the query request to the first device, the method further includes: Sending a Bluetooth Low Energy (BLE) connection request to the third device; receiving a third response message from the third device, where the third response message is used to indicate that the third device agrees to establish a BLE connection with the second device; Establishing a BLE connection with the third device, and receiving third information from the third device through the BLE connection, wherein the third information carries link establishment information of the third device; It is determined, according to the link establishment information of the third device, that the P2P port of the third device is available.

7. The method according to claim 1, wherein After the third device establishes the second P2P connection with the first device, establishing a TCP connection with the third device based on the first P2P connection and the second P2P connection includes: receiving a request message forwarded by the first device, where the request message is information used by the third device to request to establish a TCP connection with the second device, and the request message carries a first TCP port used by the third device to establish the TCP connection; In response to the request information, a fourth response message is sent to the third device through the first device, where the fourth response message carries the second TCP port used by the second device to establish the TCP connection.

8. A networking method, characterized in that: Using a third device, the method includes: Sending a first P2P connection request to a second device; wherein the second device and the first device have established a first P2P connection, the first device plays the role of a group manager (GO), and the second device plays the role of a group client (GC); receiving first information from the second device, where the first information is sent by the second device when the second device cannot establish a P2P connection with the third device; the first information is used to instruct the third device to establish a second P2P connection with the first device; establishing a second P2P connection with the first device according to the first information; An upper layer Transmission Control Protocol (TCP) connection is established with the second device based on the first P2P connection and the second P2P connection.

9. The method according to claim 8, wherein The first information includes: link establishment information of the first device; The establishing a second P2P connection with the first device according to the first information includes: Sending a second P2P establishment request to the first device; receiving a second response message from the first device, where the second response message carries the P2P port and IP address allocated by the first device to the third device; Based on the P2P port and the IP address, a P2P connection is established with the first device in the GC role.

10. The method according to claim 8, wherein The first information includes: link establishment information of the first device, a P2P port and an IP address allocated by the first device to the third device; The establishing a second P2P connection with the first device according to the first information includes: Based on the P2P port and the IP address, establish the second P2P connection with the first device in the GC role.

11. The method according to any one of claims 9 to 10, wherein: The first P2P connection request carries the link establishment information of the third device.

12. The method according to any one of claims 9 to 10, wherein: After sending the first P2P connection request to the second device, the method further includes: receiving a BLE connection request from the second device; Sending a third response message to the second device, where the third response message is used to indicate that the third device agrees to establish a BLE connection with the second device, so that the second device and the third device establish a BLE connection; Sending third information to the second device through the BLE connection, where the third information carries link establishment information of the third device, and the link establishment information of the third device is used to indicate that the P2P port of the third device is available.

13. The method according to any one of claims 8 to 10, wherein: The establishing a TCP connection with the second device based on the first P2P connection and the second P2P connection includes: A request message sent by the first device to the second device, where the request message is used to request establishment of a TCP connection with the second device, and the request message carries a first TCP port used by the third device to establish the TCP connection; receiving, through the first device, a fourth response message from the second device, where the fourth response message carries a second TCP port used by the second device to establish the TCP connection; A TCP connection is established with the second device based on the first TCP port and the second TCP port.

14. A networking method, characterized in that: Applied to a first device, the first device and a second device establish a first point-to-point P2P connection, the first device plays the role of a group manager (GO), and the second device plays the role of a group client (GC); the method includes: establishing a second P2P connection with a third device based on the first information; the first information is sent to the third device when the third device requests to establish a P2P connection with the second device and the second device confirms that a P2P connection cannot be established with the third device; the first information is used to instruct the third device to establish a second P2P connection with the first device; An upper layer Transmission Control Protocol (TCP) connection is established between the second device and the third device based on the first P2P connection and the second P2P connection.

15. The method according to claim 14, wherein Before establishing the second P2P connection with the third device, the method further includes: Receive a query request from the second device, and send a first response message to the second device in response to the query request; wherein the query request is used to query whether the first device allows access to a new GC device, and the first response message is used to indicate that the first device allows access to a new GC device.

16. The method according to claim 14 or 15, wherein: Establishing a second P2P connection with the third device includes: receiving a second P2P establishment request from the third device; In response to the second P2P establishment request, a second response message is sent to the third device, where the second response message carries the P2P port and IP address allocated by the first device to the third device.

17. The method according to claim 14 or 15, characterized in that The establishing an upper layer TCP connection between the second device and the third device based on the first P2P connection and the second P2P connection includes: receiving a request message from the third device through the second P2P connection, and forwarding the request message to the second device through the first P2P connection; the request message is used to indicate that the third device requests to establish a TCP connection with the second device, and the request message carries a first TCP port used by the third device to establish the TCP connection; receiving a fourth response message from the second device through the first P2P connection, where the fourth response message carries a second TCP port used by the second device to establish the TCP connection; Forward the fourth response message to the third device through the second P2P connection.

18. A networking device, characterized in that: A second device applied to a networking system, wherein the networking system further includes a first device and a second device having a first P2P connection established therebetween, wherein the first device plays the role of a group manager (GO) and the second device plays the role of a group client (GC); the networking device includes: A communication module, configured to receive a first P2P connection request from a third device; The communication module is further configured to, upon determining that the communication module cannot establish a P2P connection with the third device, return first information to the third device, so that the third device establishes a second P2P connection with the first device according to the first information; A processing module is configured to establish an upper layer Transmission Control Protocol (TCP) connection with the third device based on the first P2P connection and the second P2P connection after the third device establishes the second P2P connection with the first device.

19. A networking device, characterized in that: A third device is applied to a networking system, the networking system further comprising a first device and a second device, wherein the first device and the second device establish a first P2P connection, the first device plays the role of a group manager (GO), and the second device plays the role of a group client (GC); the networking device comprises: a communication module, configured to send a first P2P connection request to the second device; The communication module is further configured to receive first information from the second device, where the first information is sent by the second device when the second device cannot establish a P2P connection with the third device; the first information is used to instruct the third device to establish a second P2P connection with the first device; a processing module, configured to establish a second P2P connection with the first device according to the first information; The processing module is further configured to establish an upper layer Transmission Control Protocol (TCP) connection with the second device based on the first P2P connection and the second P2P connection.

20. A networking device, characterized in that: A first device is applied to a networking system, the networking system further comprising a second device and a third device, wherein the first device and the second device establish a first point-to-point P2P connection, the first device plays the role of a group manager (GO), and the second device plays the role of a group client (GC); the networking device comprises: a processing module, configured to establish a second P2P connection with the third device; the second P2P connection being established between the third device and the third device based on first information, the first information being sent to the third device when the third device requests to establish a P2P connection with the second device and the second device confirms that a P2P connection cannot be established with the third device; the first information being used to instruct the third device to establish the second P2P connection with the first device; The processing module is further configured to establish an upper layer Transmission Control Protocol (TCP) connection between the second device and the third device based on the first P2P connection and the second P2P connection when the third device establishes a second P2P connection with the first device based on the first information.

21. A networking system, characterized in that: The networking system includes a first device, a second device, and a third device, wherein the first device and the second device establish a first point-to-point P2P connection, and the first device plays the role of a group manager (GO), and the second device plays the role of a group client (GC); The second device is configured to perform the method according to any one of claims 1 to 7; The third device is configured to perform the method according to any one of claims 8 to 13; The first device is configured to execute the method according to any one of claims 14 to 17.

22. An electronic device, characterized in that: include: at least one processor; and a memory and a communication interface communicatively connected to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the at least one processor executes the instructions stored in the memory, so that the electronic device executes the method as described in any one of claims 1-7, or claims 8-13, or claims 14-17.

23. A computer-readable storage medium, characterized in that The method comprises a program or an instruction, which, when being executed on a computer, causes the method according to any one of claims 1 to 7, or claims 8 to 13, or claims 14 to 17 to be executed.

Citation Information

Patent Citations

  • Method and device for communication between devices

    CN104518959A