P2P connection method and device

By setting up link modules and application modules in electronic devices and deciding on P2P connection configurations, bridging communication between different types of devices is achieved, solving the problem of degraded WIFI P2P communication quality and improving the connection efficiency and data transmission quality between devices.

CN121968366APending Publication Date: 2026-05-01HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HONOR DEVICE CO LTD
Filing Date
2024-10-29
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

When establishing a Wi-Fi P2P communication connection between electronic devices, unreasonable negotiation can lead to a decrease in communication quality, especially when making P2P connections between different types of devices.

Method used

By setting up link modules and application modules in electronic devices, which are used to decide on P2P connection configurations, including role information, network card information, and frequency information, P2P bridging communication between different types of devices is realized, and a new and old protocol switching mechanism is used for bridging negotiation.

Benefits of technology

It improves the quality of P2P communication between electronic devices, ensuring effective connection and data transmission between different types of devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121968366A_ABST
    Figure CN121968366A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a P2P connection method and device, and relates to the technical field of communication. According to the method, P2P connection establishment of different types of electronic equipment (such as equipment of a first type decided by using an application module and equipment of a second type decided by using a link module and old equipment) can be realized in a multi-equipment scene. The method comprises the following steps: receiving a first operation of a user, wherein the first operation is used for instructing a second electronic device to establish P2P connection with a third electronic device; and the third electronic equipment sends a first negotiation packet to the second electronic equipment, wherein the first negotiation packet comprises the WI FI capability information of the third electronic equipment. And receiving a first reply packet, wherein the first reply packet comprises WI FI capability information of the second electronic equipment. And according to the WI FI capability information of the second electronic equipment and the WI FI capability information of the third electronic equipment, the link module of the third electronic equipment establishes P2P bridging communication with the second electronic equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technology, and in particular to a P2P connection method and device. Background Technology

[0002] To better serve users, various electronic devices can exchange data (information), enabling functions such as file sharing, multi-screen collaboration, and screen mirroring. Electronic devices can use Wi-Fi Direct (also known as peer-to-peer, P2P) technology for data transmission. Compared to Bluetooth communication, Wi-Fi P2P offers a longer communication distance and greater bandwidth, providing significant advantages.

[0003] However, when electronic devices establish a Wi-Fi P2P communication connection, they need to negotiate the channel for the Wi-Fi P2P connection and the device acting as the group owner (GO). If the negotiation is not reasonable, it will lead to a decrease in the quality of Wi-Fi P2P communication. Summary of the Invention

[0004] This application provides a P2P connection method and device, which can realize P2P connection between different types of electronic devices (such as first type of devices that use application module decision and second type of devices and old devices that use link module decision) in multi-device scenarios.

[0005] To achieve the above technical objectives, this application adopts the following technical solution:

[0006] Firstly, a P2P connection method is provided, applied to a third electronic device. A second electronic device and a first electronic device have established a first P2P connection. The method is used for the third electronic device to establish a P2P connection with the second electronic device. Both the third and second electronic devices are of a second type. The framework layer of the second-type device includes a link module for determining the P2P connection configuration of the second-type device. The P2P connection configuration includes at least one of the following: role information as a GO / GC (Go / GC), network interface card (NIC) information, and frequency information for P2P communication. The first electronic device is of a first type. The application layer of the first-type device includes an application module for determining the P2P connection configuration of the first-type device. The method includes: receiving a first operation from a user, the first operation instructing the second electronic device to establish a P2P connection with the third electronic device; and the third electronic device sending a first negotiation packet to the second electronic device, the first negotiation packet including Wi-Fi capability information of the third electronic device, the Wi-Fi capability information including at least one of the following: the identifier, model, and available channel of at least one NIC, and information on existing Wi-Fi connections of the local device. A first response packet is received, which includes the Wi-Fi capability information of the second electronic device. Based on the Wi-Fi capability information of the second electronic device and the third electronic device, the link module of the third electronic device establishes P2P bridging communication with the second electronic device.

[0007] For example, in some scenarios, the initiating device C (i.e., the device receiving the user's operation) is a new, connectionless device (the second device), the receiving device B is a new device (the second device) with a P2P connection and the role of GC, and the GO device (device A) is an old protocol device (the first device). In this way, the initiating device C can initiate bridging negotiations for the new protocol (the second protocol) to device B. After receiving the bridging negotiation packet, device B can determine to switch from the new protocol to the old protocol for bridging based on the fact that the connected GO (device A) is an old device. Thus, device B can notify the initiating device C in its reply packet to device C to switch to the old protocol for bridging.

[0008] Correspondingly, if the initiating device is device B, the GO that has been connected can be considered an old device. Even if device C is a new device, the old protocol will still be used to perform bridging.

[0009] Optionally, after receiving the first operation, the method further includes: the smart interconnection application of the third electronic device sending a first connection call to the application module of the third electronic device, the first connection call including P2P communication information corresponding to the first operation; the application module of the third electronic device establishing a first encrypted negotiation channel with the application module of the second electronic device, the first encrypted negotiation channel being used for data transmission between the application module of the second electronic device and the application module of the third electronic device; and the application module of the third electronic device registering a first auxiliary channel with the link module of the third electronic device, the first auxiliary channel being used for data transmission between the link module of the third electronic device and the application module of the third electronic device.

[0010] Optionally, the method further includes: the application module of the third electronic device sending a first connection establishment instruction to the link module of the third electronic device, the first connection establishment instruction indicating that the second electronic device is a second type of electronic device, and the first connection establishment instruction further instructing the link module of the third electronic device to establish a P2P connection with the second electronic device. In response to the first connection establishment instruction, the link module of the third electronic device generates the first negotiation packet.

[0011] Optionally, after receiving the first reply packet, the method further includes: the link module of the third electronic device determines, based on the WIFI capability information of the second electronic device and the WIFI capability information of the third electronic device, that there is a usable network card on the local end and that the second electronic device does not have a usable network card, and establishes a P2P connection with the second electronic device using P2P bridging communication.

[0012] Optionally, the method further includes: the link module of the third electronic device sending a first error code to the application module of the third electronic device, the first error code indicating the establishment of P2P bridging communication with the second electronic device; the application module of the third electronic device sending a first bridging request, the first bridging request including available network interface card information of the third electronic device and / or role information of the second electronic device; the first bridging request being used by the second electronic device to determine the connection configuration for establishing P2P bridging communication with the third electronic device.

[0013] Optionally, the method further includes: receiving a second bridging request, the second bridging request including at least one of the following: GO connection information of the first electronic device, the IP address of the third electronic device, the IP address and TCP port information of the first electronic device, and the IP address of the second electronic device. Based on the GO connection information in the second bridging request, the third electronic device establishes a WI FIP2P physical link connection with the first electronic device. Based on the IP address and TCP port information of the first electronic device in the second bridging request, the third electronic device establishes a TCP encrypted channel with the first electronic device. Based on the IP address of the second electronic device in the second bridging request, the third electronic device establishes a smart interconnection network sharing and interaction negotiation with the second electronic device.

[0014] Secondly, a P2P communication method is provided, applied to a second electronic device that has established a first P2P connection with a first electronic device. This method is used for a third electronic device to establish a P2P connection with the second electronic device. Both the third and second electronic devices are of a second type. The framework layer of the second-type device includes a link module for determining the P2P connection configuration of the second-type device. The P2P connection configuration includes at least one of the following: GO / GC role information, network interface card (NIC) information, and frequency information for P2P communication. The first electronic device is of a first type. The application layer of the first-type device includes an application module for determining the P2P connection configuration of the first-type device. The method includes: receiving a first negotiation packet from the third electronic device, the first negotiation packet including Wi-Fi capability information of the third electronic device, the Wi-Fi capability information including at least one of the following: the identifier, model, and available channel of at least one NIC, and information on existing Wi-Fi connections established by the local device; and sending a first reply packet, the first reply packet including the Wi-Fi capability information of the second electronic device. A first bridging request is received, which includes the available network interface card (NIC) information of the third electronic device and / or the role information of the second electronic device. This first bridging request is used by the second electronic device to determine the connection configuration for establishing P2P bridging communication with the third electronic device. A second bridging request is sent, which includes at least one of the following: the GO connection information of the first electronic device, the IP address of the third electronic device, the IP address and TCP port information of the first electronic device, and the IP address of the second electronic device. If the bridging between the third electronic device and the first electronic device is successful, the second electronic device and the third electronic device perform intelligent interconnection network sharing negotiation.

[0015] Optionally, the successful bridging between the third electronic device and the first electronic device includes: the third electronic device and the first electronic device establishing a Wi-Fi FIP2P physical link connection and a TCP encrypted channel.

[0016] Optionally, before receiving the first negotiation packet, the method further includes: establishing a first encrypted negotiation channel between the application module of the second electronic device and the application module of the third electronic device, the first encrypted negotiation channel being used for data transmission between the application module of the second electronic device and the application module of the third electronic device. The application module of the second electronic device registers a second auxiliary channel with the link module of the second electronic device, the second auxiliary channel being used for data transmission between the link module of the second electronic device and the application module of the second electronic device.

[0017] Optionally, receiving the first negotiation packet includes: the application module of the second electronic device receiving the first negotiation packet; the application module of the second electronic device sending the second negotiation packet to the link module of the second electronic device through the first auxiliary channel; and the link module of the second electronic device generating the first response packet based on the first negotiation packet.

[0018] Optionally, after receiving the first bridging request, the method further includes: sending a third bridging request to the first electronic device, the third bridging request being used to request the first electronic device to allocate an IP address to the third electronic device. Receiving a third reply message, the third reply message including at least one of the following: the IP address of the third electronic device, the GO connection information of the first electronic device, and the IP address and TCP port information of the first electronic device. The GO connection information includes at least the SSID and password corresponding to the GO of the first electronic device.

[0019] Optionally, the method further includes: storing the IP address of the third electronic device based on the third response message; and generating the second bridging request.

[0020] Optionally, generating the second bridging request includes: generating the second bridging request based on the IP address of the second electronic device and the third response message.

[0021] Optionally, the second electronic device and the third electronic device perform smart interconnection network sharing interaction negotiation, including: the smart interconnection application of the second electronic device performs network sharing interaction negotiation with the smart interconnection application of the third electronic device based on the IP of the third electronic device.

[0022] Thirdly, a P2P connection method is provided. This method is applied to a first electronic device, a second electronic device, and the first electronic device having established a first P2P connection. The method is also used for a third electronic device to establish a P2P connection with the second electronic device. Both the third and second electronic devices are of a second type. The framework layer of the second-type device includes a link module for determining the P2P connection configuration of the second-type device. The P2P connection configuration includes at least one of the following: role information as a GO / GC (Go / GC), network interface card (NIC) information, and frequency information for P2P communication. The first electronic device is of a first type. The application layer of the first-type device includes an application module for determining the P2P connection configuration of the first-type device. The method includes: receiving a third bridging request, which requests the first electronic device to allocate an IP address to the third electronic device; and sending a third reply message, which includes the IP address allocated to the third electronic device. The IP address of the third electronic device is used to establish P2P bridge communication between the third electronic device and the second electronic device.

[0023] Optionally, the third response message may also include at least one of the following: the GO connection information of the first electronic device, and the IP and TCP port information of the first electronic device. The GO connection information includes at least the SSID and password corresponding to the GO of the first electronic device.

[0024] Optionally, receiving the third bridging request includes: the application module of the first electronic device receiving a bridging request from the second electronic device. After receiving the third bridging request, the method further includes: the application module of the first electronic device sending a first IP allocation instruction to the link module of the first electronic device. The link module of the first electronic device, based on the first IP allocation instruction, sends an IP address allocated to the third electronic device to the application module of the first electronic device. The third reply message is generated based on the IP address of the third electronic device, the GO connection information of the first electronic device, and the IP address and TCP port information of the first electronic device.

[0025] Fourthly, an electronic device is provided, comprising: a memory and one or more processors. The memory and the processors are coupled. The memory stores computer program code, which includes computer instructions. When the processor executes the computer instructions, the electronic device performs the technical solutions provided in the first aspect and any possible implementation thereof, or performs the technical solutions provided in the second aspect and any possible implementation thereof, or performs the technical solutions provided in the third aspect and any possible implementation thereof.

[0026] Fifthly, this application also provides a chip system applied to an electronic device; the chip system may include one or more interface circuits and one or more processors. The interface circuits and processors are interconnected via lines, and the interface circuits are used to receive signals from the electronic device's memory and send the signals to the processors, the signals including computer instructions stored in the memory. When the processor executes the aforementioned computer instructions, the electronic device executes the technical solutions provided in the first aspect and any possible implementation thereof, or executes the technical solutions provided in the second aspect and any possible implementation thereof, or executes the technical solutions provided in the third aspect and any possible implementation thereof.

[0027] Sixthly, this application also provides a computer-readable storage medium including computer instructions that, when executed on an electronic device, cause the electronic device to perform the technical solutions provided in the first aspect and any possible implementation thereof, or to perform the technical solutions provided in the second aspect and any possible implementation thereof, or to perform the technical solutions provided in the third aspect and any possible implementation thereof.

[0028] In a seventh aspect, this application also provides a computer program product that, when run on a computer, causes the computer to execute the technical solutions provided in the first aspect and any possible implementation thereof, or to execute the technical solutions provided in the second aspect and any possible implementation thereof, or to execute the technical solutions provided in the third aspect and any possible implementation thereof.

[0029] It is understood that the solutions provided in the second to seventh aspects of this application can be respectively associated with the first aspect and any of its possible designs, and therefore the beneficial effects achieved are similar, which will not be repeated here. Attached Figure Description

[0030] Figure 1 A schematic diagram illustrating a communication scenario provided in an embodiment of this application;

[0031] Figure 2 This is a schematic diagram illustrating the composition of a first device provided in an embodiment of this application;

[0032] Figure 3 A schematic diagram illustrating a P2P direct connection process between first devices provided in an embodiment of this application;

[0033] Figure 4 This is a schematic diagram illustrating the composition of a second device provided in an embodiment of this application;

[0034] Figure 5A A schematic diagram illustrating a P2P direct connection process between second devices provided in an embodiment of this application;

[0035] Figure 5B A schematic diagram illustrating a P2P direct connection process between second devices provided in an embodiment of this application;

[0036] Figure 6A A schematic diagram illustrating a P2P connection between a first device and a second device provided in an embodiment of this application;

[0037] Figure 6B A schematic diagram illustrating a P2P connection between a first device and a second device provided in an embodiment of this application;

[0038] Figure 7A A schematic diagram illustrating a P2P connection between a first device and a second device provided in an embodiment of this application;

[0039] Figure 7B A schematic diagram illustrating a P2P connection between a first device and a second device provided in an embodiment of this application;

[0040] Figure 8 A schematic diagram illustrating a multi-device interaction scenario provided in an embodiment of this application;

[0041] Figure 9A This application provides a schematic diagram of a P2P connection process in an embodiment of the present application.

[0042] Figure 9B This application provides a schematic diagram of a P2P connection process in an embodiment of the present application.

[0043] Figure 10A This application provides a schematic diagram of a P2P connection process in an embodiment of the present application.

[0044] Figure 10B This application provides a schematic diagram of a P2P connection process in an embodiment of the present application.

[0045] Figure 11A This application provides a schematic diagram of a P2P connection process in an embodiment of the present application.

[0046] Figure 11B This application provides a schematic diagram of a P2P connection process in an embodiment of the present application.

[0047] Figure 12 A schematic diagram illustrating the composition of an electronic device provided in an embodiment of this application;

[0048] Figure 13 This is a schematic diagram of the composition of a chip system provided in an embodiment of this application. Detailed Implementation

[0049] In smart living scenarios (such as smart office, sports and health, smart home, smart travel and audio-visual entertainment), multiple electronic devices can work together to provide users with a variety of rich user experiences.

[0050] refer to Figure 1 For example, consider multiple electronic devices, including device A and device B.

[0051] Device A or Device B can be at least one of the following: mobile phone, foldable electronic device, tablet computer, desktop computer, laptop computer, handheld computer, laptop, smart TV, smart screen, ultra-mobile personal computer (UMPC), netbook, cellular phone, personal digital assistant (PDA), augmented reality (AR) device, virtual reality (VR) device, artificial intelligence (AI) device, wearable device, in-vehicle device, smart home device, or smart city device.

[0052] Device A and Device B can be interconnected via peer-to-peer (P2P) connection technology. Through this P2P connection, data can be exchanged between the devices. Therefore, Device A and Device B can cooperate to provide P2P services to users.

[0053] For example, the P2P service may include: file sharing, multi-screen collaboration, screen sharing, network sharing, etc.

[0054] In some implementations, the P2P connection between device A and device B can be established based on the Wi-Fi protocol. Device A and device B can use the frequency band / channel of Wi-Fi communication to transmit P2P data.

[0055] Therefore, this P2P connection established based on the WIFI protocol can also be called a Wi-Fi IP2P connection. Data transmission of P2P services between devices via a P2P connection can also be called inter-device P2P communication.

[0056] In P2P communication, each device can play a different role.

[0057] For example, consider P2P communication between device A and device B. Device A and device B can each include a device that acts as the P2P communication manager, such as a group owner (GO) device. Correspondingly, the other device besides the GO device can be a managed / group client (GC) device. The GO device is abbreviated as GO. The GC device is abbreviated as GC.

[0058] A Go instance can connect to one or more garbage collectors (GCs) simultaneously. However, a GC can only connect to one Go instance at a time.

[0059] It should be noted that electronic devices may contain one or more network interface card (NIC) chips. Each NIC chip can provide corresponding wireless communication capabilities. For example, these wireless communication capabilities may include Wi-Fi / Bluetooth communication capabilities. A NIC chip with Wi-Fi / Bluetooth communication capabilities can also be called a Wi-Fi chip.

[0060] In some implementations, electronic devices can virtualize the wireless communication capabilities of a single network interface card (NIC) chip across one or more NICs. A single NIC can be used to provide one P2P connection.

[0061] Taking an electronic device with network interface card 0 as an example. At any given time, network interface card 0 can act as a GO (Go) and communicate in P2P with one or more GCs (GCs). Alternatively, network interface card 0 can act as a GC and communicate in P2P with another GO.

[0062] Taking an electronic device equipped with network interface card 0 (NIC 0) and network interface card 1 (NIC 1) as an example, NIC 0 can act as a go-go (GO) or GC (GC) to establish a P2P communication with other devices at the same time. Similarly, NIC 1 can also act as a GO or GC to establish another P2P communication with other devices.

[0063] Establishing a P2P connection between devices generally includes the following steps 1 to 3:

[0064] Step 1: Device A and Device B perform device discovery, security authentication, and device online.

[0065] Step 2: Device A and Device B establish an encrypted negotiation channel and negotiate the connection establishment based on the established encrypted negotiation channel. Through the connection establishment negotiation, Device A and Device B can synchronously establish the connection configuration for a P2P connection.

[0066] The connection configuration may include at least one of the following: frequency information used by the P2P connection (such as frequency band, frequency point, channel, etc.), role information in the P2P connection (such as the device acting as a GC), data transmission information (such as device IP, Transmission Control Protocol (TCP) port), and network card information for the P2P connection (such as network card identifier, etc.).

[0067] Step 3: Establish a Wi-Fi 2P physical link between devices according to the connection configuration. Based on this Wi-Fi 2P physical link, establish a TCP channel.

[0068] Through the above three steps, a P2P connection can be established between devices, and then P2P business data can be transmitted through the TCP channel of the P2P connection.

[0069] In this embodiment of the application, the electronic device can use its internally configured software module in conjunction with the hardware module to achieve the establishment of the P2P connection in the above three steps.

[0070] For example, in some embodiments of this application, electronic devices can determine the connection configuration of P2P connections through components deployed in the framework layer (such as a Wi-Fi link module). This type of electronic device can be referred to as a first device, an old protocol device, or an older device. Correspondingly, during data transmission between first devices, a first protocol (or an older protocol) corresponding to the first device can be used. For example, the first protocol may include a first direct connection protocol, a first bridging protocol, etc.

[0071] In other embodiments of this application, the electronic device can determine the connection configuration of the P2P connection through components deployed at the application layer (such as application layer modules). This type of electronic device can be referred to as a second device, a new protocol device, or a novel device. Correspondingly, during data transmission between second devices, a second protocol (or a new protocol) corresponding to the second device can be used. For example, the second protocol may include a second direct connection protocol, a second bridging protocol, etc.

[0072] The first protocol may differ from the second protocol. For example, the field positions specified in the first protocol may differ from those specified in the second protocol. Similarly, the field content specified in the first protocol may differ from the field content specified in the second protocol.

[0073] As one possible implementation, during data transmission based on the second protocol, the data may carry a first header corresponding to the second protocol. This first header may be added by the application module of the electronic device when transmitting the data. However, during data transmission based on the first protocol, the data may not carry the first header.

[0074] In another possible implementation, the data corresponding to the first protocol may include identification information indicating the first protocol, thereby indicating that the data is based on direct / bridging negotiation of the first protocol. Correspondingly, the data corresponding to the second protocol may include identification information indicating the second protocol, thereby indicating that the data is based on direct / bridging negotiation of the second protocol.

[0075] Examples will be given below.

[0076] In this example, the software systems of the first and / or second devices can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment uses a layered architecture... Taking the system as an example, the software structure of the first device is illustrated.

[0077] A layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, [the following is omitted as the text is incomplete and likely refers to a specific implementation or feature]. The system is divided into five layers, from top to bottom: application layer, application framework layer, Android runtime (ART) and native C / C++ library, hardware abstraction layer (HAL) and kernel layer.

[0078] refer to Figure 2 A schematic diagram of the software composition of a first device is provided. As described above, during the establishment of a P2P connection, the first device can determine the connection configuration, such as frequency information, and / or role information, and / or data transmission information, to be used in the P2P connection through a connection application layer module deployed in the application layer.

[0079] In this example, the application layer can also be called the application layer or APP layer. This application layer can include a series of application packages.

[0080] like Figure 2 As shown, the application package may include applications such as smart interconnection applications. In some implementations, the smart interconnection application can be a standalone application visible to the user. This smart interconnection application can provide an interface for one or more scenarios within a smart living environment. For example, when the smart interconnection application is running, it can display a P2P service-related interface to the user through the display screen of a first device.

[0081] In this example, the application layer can also deploy a connection application layer module. In some implementations, this connection application layer module may also be called the MagicLink application module, or simply the application module.

[0082] In some implementations, this application module can be invisible to the user. That is, the application module may not have a corresponding UI interface configured.

[0083] In this example, the application module in the first device can be used in conjunction with smart interconnection applications to control and manage P2P communication from the application layer.

[0084] For example, this application module can be used to discover and bring devices online via WIFI or Bluetooth; create encrypted negotiation channels between devices; negotiate connection requests between devices; control the establishment of WIFI P2P physical links between devices; and establish TCP channels between devices.

[0085] In such Figure 2 In the implementation of the solution, this application module can also be used to decide the connection configuration to be used for P2P connection.

[0086] For example, the application module of the first device can be used to determine the connection configuration based on the device information of at least two devices to establish P2P communication. The device information may include at least one of the following: possible role information of the device, and Wi-Fi capability information of the device.

[0087] Device potential role information can indicate the role a device can play in P2P communication. In some implementations, this potential role information may be preset in the device.

[0088] For example, consider a mobile phone or tablet. The possible role information for this device could be "no role." This "no role" could correspond to the device's ability to act as a GO or GC in P2P communication.

[0089] For example, let's take a laptop as an example. The possible role information for this device could be "GO". In this way, the device can act as a GO in P2P communication to manage other GC devices.

[0090] The WIFI capability information may include at least one of the following: network card information of at least one network card, available channel information, and information on established WIFI connections.

[0091] The network card information may include: the network card's identifier, model, etc.

[0092] Available channel information may include: channel number that can be used for P2P connection (i.e., unused), channel frequency, 2.4G or 5G channel, etc.

[0093] Information about established Wi-Fi connections can include: the type of Wi-Fi connection that has been established and not released (i.e., occupied), the channel frequency of the established Wi-Fi connection, the network card occupied, and information about whether the local machine is a GO or GC.

[0094] like Figure 2 As shown, the application modules may specifically include a connection control module (or P2P connection control module), a bridging module, a direct connection module, etc.

[0095] The connection control module can be used to interact with smart interconnected applications, such as receiving call instructions from smart interconnected applications.

[0096] The connection control module can also be used to control related components in other layers such as the framework layer and kernel layer through the direct connection module, and establish P2P direct communication with other devices.

[0097] The connection control module can also be used to control related components in other layers such as the framework layer and kernel layer through the bridging module to establish P2P bridge communication with other devices.

[0098] In this application, P2P direct communication may include: two devices directly establishing a P2P connection. Data for P2P services can be directly transmitted between the two devices.

[0099] P2P bridging communication can include: two devices indirectly establishing a P2P connection through a third device. Data for P2P services can be relayed between the two devices via the third device.

[0100] In the first device, the application framework layer may be referred to as the framework layer or the Framework layer.

[0101] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.

[0102] like Figure 2 As shown, in this example, the first device may include a WIFI management module and a WIFI link module.

[0103] The WIFI management module can also be called the Android WIFI management module. The Android WIFI management module is a native Android module that can be used to manage the first network card (e.g., network card 0) of the first device to establish or disconnect a P2P connection with the peer device.

[0104] A Wi-Fi link module, often simply referred to as a link module, is used to manage network interface cards (NICs) extended in electronic devices. In this example, the Wi-Fi link module may include a Wi-Fi protocol stack. Through this stack, the Wi-Fi link module can use the native TCP / IP protocol to communicate with other devices via Wi-Fi (such as Wi-Fi-based P2P communication). In other embodiments, the Wi-Fi protocol stack may be located outside the Wi-Fi link module, with the link module calling relevant functions within the stack for Wi-Fi communication.

[0105] Correspondingly, application modules between devices can also communicate by calling this Wi-Fi protocol stack.

[0106] In this application, the WIFI link module can also be used to obtain WIFI capability information of an electronic device. As described above, the WIFI capability information may include at least one of the following: network card information of at least one network card, available channel information, and information on established WIFI connections.

[0107] In other words, the WIFI link module can be used to sense the WIFI capability of electronic devices and changes in WIFI capability.

[0108] Based on the aforementioned functional description of the application module in the first device, in this example, the Wi-Fi link module can also be used to report Wi-Fi capability information to the application module. In this way, the application module can use the Wi-Fi capability information to decide on the connection configuration used for the P2P connection.

[0109] In other implementations of this application, the framework layer of the electronic device (such as the first device) may also be configured with more modules.

[0110] For example, the application framework layer may also include a window manager, content provider, view system, resource manager, notification manager, activity manager, input manager, etc.

[0111] The window manager provides Window Manager Service (WMS), which can be used for window management, window animation management, surface management, and as a relay station for the input system.

[0112] Content providers store and retrieve data, making that data accessible to applications. This data can include videos, images, audio, phone calls made and received, browsing history and bookmarks, phone books, etc.

[0113] A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon could include views for displaying text and views for displaying images.

[0114] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, and more.

[0115] The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of completed downloads or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating electronic devices, and flashing indicator lights.

[0116] The Activity Manager can provide the Activity Manager Service (AMS), which can be used to start, switch, and schedule system components (such as activities, services, content providers, and broadcast receivers), as well as manage and schedule application processes.

[0117] The Input Manager Service (IMS) provides input management services, which can be used to manage system inputs such as touchscreen input, keypad input, and sensor input. IMS retrieves events from input device nodes and, through interaction with the WMS (Windows Management System), distributes these events to appropriate windows.

[0118] In such Figure 2 In the example, the kernel layer of the first device can be a layer between hardware and software. The kernel layer can include one or more driver modules. Through the driver modules, modules in the upper layers (such as the framework layer or application layer) can control or instruct various devices in the hardware layer to implement corresponding functions via instructions.

[0119] For example, consider a device equipped with a Wi-Fi chip. The electronic device can virtualize the Wi-Fi communication capabilities of this chip into one or more network interface cards (NICs). A virtualized NIC can correspond to a NIC driver in the kernel layer. By calling this NIC driver, Wi-Fi communication (such as Wi-Fi-based P2P communication) can be performed using the virtualized NIC.

[0120] For example, the network interface card (NIC) of the first device may include NIC 0. Correspondingly, a NIC driver for NIC 0 can be configured in the kernel layer. For ease of explanation, "NIC" hereafter can refer to both the virtualized NIC and the corresponding NIC driver in the kernel layer.

[0121] In this way, when the first device engages in P2P communication with other devices, the connection application layer module can decide on the communication configuration for using network interface card 0 (NIC 0) based on the Wi-Fi capability information reported by the Wi-Fi link module. Thus, the first device can establish a P2P connection with other devices through NIC 0 based on this communication configuration, and then transmit P2P service data through this P2P connection.

[0122] Generally speaking, such as Figure 2 The first device shown can be configured and maintained via a single P2P connection through the application layer module.

[0123] Combination Figure 2 The first device shown, reference Figure 3 This is a schematic diagram illustrating the interaction flow of a P2P connection establishment method. In this example, both devices establishing the P2P connection can be, for example, [devices described in the original text]. Figure 2 The first device shown. That is, as... Figure 3 Both device 1 and device 2 shown can be the first device. The connection configuration of the P2P connection can be determined by their respective application modules.

[0124] In this example, device 1 can be configured with Smart Interconnection 1 (corresponding to, for example, ...). Figure 2 The smart interconnected application shown), application module 1 (corresponding to the following) Figure 2 The connection application layer module shown), link module 1 (corresponding to, as shown) Figure 2 (as shown in the WIFI link module). Accordingly, device 2 can be configured with smart interconnection 2, application module 2, and link module 2.

[0125] like Figure 3 As shown, the method may include:

[0126] S301, Device 1 and Device 2 perform device discovery, and the devices come online.

[0127] For example, after enabling short-range communication, device 1 and device 2 can respectively perform device discovery and go online.

[0128] Short-range communication capabilities can include Bluetooth (BT) communication or Wi-Fi communication. Let's take Bluetooth communication as an example.

[0129] Taking device 1 as an example. In some implementations, device 1 can enable Bluetooth communication upon user instruction. In other implementations, device 1's Bluetooth communication function is enabled by default. Thus, device 1 can automatically enable Bluetooth communication upon power-on. Device 2 enables Bluetooth communication in a similar way.

[0130] After enabling Bluetooth communication, Device 1 can send Bluetooth broadcasts. Similarly, after enabling Bluetooth communication, Device 2 can also send Bluetooth broadcasts.

[0131] In some embodiments, application module 1 of device 1 can discover device 2 based on a Bluetooth broadcast sent by device 2. In other embodiments, application module 2 of device 2 can discover device 1 based on a Bluetooth broadcast sent by device 1.

[0132] Thus, Device 1 and Device 2 achieve device discovery by receiving Bluetooth broadcasts sent by the peer device.

[0133] Based on this short-range communication (such as Bluetooth communication) for device discovery, Device 1 and Device 2 can establish a corresponding communication link and perform security verification based on the communication link.

[0134] For example, application module 1 of device 1 can establish a Bluetooth connection with application module 2 of device 2 through link module 1 of device 1 and link module 2 of device 2.

[0135] Device 1 and Device 2 can use this Bluetooth connection to perform device security authentication, confirming that the other end is a trusted device (i.e., performing security verification). Afterwards, Device 1 and Device 2 can also exchange keys via this Bluetooth connection to facilitate secure communication based on those keys.

[0136] After completing the security verification, Device 1 and Device 2 can synchronize the basic Wi-Fi parameters of the other end. In some implementations, the basic Wi-Fi parameters can be used by the devices to make preliminary judgments, thereby initially determining the connection configuration (or some parameters in the connection configuration) of the P2P connection.

[0137] The basic WIFI parameters may include at least one of the following parameters of the corresponding device:

[0138] The application module version information and the WIFI link module version number indicate the number of WIFI network cards supported by the device, the number of WIFI IP2P links supported, and the supported business scenarios (e.g., Trust Ring, Honor Share).

[0139] For example, device 1 and device 2 can synchronize basic WIFI parameters through an established Bluetooth connection.

[0140] Take the example of device 1 obtaining the basic WIFI parameters of device 2.

[0141] Application module 1 of device 1 can send a Wi-Fi basic parameter acquisition request to device 2 via link module 1. Correspondingly, device 2 can receive the Wi-Fi basic parameter acquisition request via link module 2. Link module 2 can then forward this request to application module 2. Upon receiving the request, application module 2 can send the Wi-Fi basic parameter acquisition request of device 2 to link module 1 via link module 2. Application module 1 can then obtain the Wi-Fi basic parameters of device 2 from link module 1. Thus, device 1 can acquire the Wi-Fi basic parameters of device 2.

[0142] The basic WIFI parameters of device 2 can be pre-configured in application module 2, or collected by link module 2 and reported to application module 2 after device 2 is powered on (or triggered by a preset mechanism).

[0143] Similarly, device 2 can obtain the basic WIFI parameters of device 1.

[0144] In some examples, after synchronizing the basic WIFI parameters, Device 1 and Device 2 can determine whether they can conduct at least one P2P communication with the peer device based on the peer's basic WIFI parameters.

[0145] Thus, Device 1 and Device 2 can complete the device online process. In some implementations, after the devices are online, the corresponding interface of Device 1's Smart Interconnection 1 will display the status of Device 2 as online to the user. Based on this, the user can instruct Device 1 to conduct P2P communication with Device 2 through the interface of Device 1's Smart Interconnection 1. Conversely, the relevant interface of Device 2 can also be adjusted and displayed according to the fact that Device 1 is online, so that the user can operate Device 2 and instruct Device 2 to conduct P2P communication with Device 1.

[0146] S302, The user operates device 1 to initiate screen sharing to device 2.

[0147] In this example, the user instructs device 1 to initiate screen sharing with device 2. In other embodiments, the user may also instruct device 1 to perform other types of P2P communication with device 2. In other embodiments, the user may also instruct device 2 to perform P2P communication with device 1.

[0148] In some embodiments, Smart Connect 1 can determine to share the screen based on user actions.

[0149] Smart Interconnect 1 can determine the quality of service (QoS) information for the screen sharing service.

[0150] In this application, the QoS information of a service (e.g., a screen sharing service) may include one or more of the following: expected bandwidth, latency, jitter, priority, etc. For example, a screen sharing service may be a high-bandwidth service. For example, the expected bandwidth of a screen sharing service may be greater than a preset bandwidth (e.g., 40MB / s). Another example is that a screen sharing service may be a low-latency service. For example, the latency requirement for a screen sharing service may be less than 20ms.

[0151] S303, Smart Interconnection 1 sends connection call information 31 to application module 1.

[0152] For example, the connection call information 31 can be used to call the device connection interface of application module 1. In some implementations, the connection call information 31 may include QoS information of the current service (such as screen sharing service) passed to the screen sharing service.

[0153] In some embodiments, after receiving the connection call information 31, the application module 1 may execute the following S304.

[0154] In other embodiments, before executing S304 and negotiating with device 2, application module 1 may also determine that device 1 and device 2 meet the QoS requirements of the current service based on the QoS information in the connection call information 31 and the basic WIFI parameters (such as the basic parameters of device 1 and / or device 2). If device 1 and device 2 meet the QoS requirements of the current service, the following S304 is executed.

[0155] S304. Application Module 1 and Application Module 2 create an encrypted negotiation channel NC1.

[0156] S305, Application Module 1 stores information in channel NC1.

[0157] S306, Application Module 2 stores information in channel NC1.

[0158] For example, the encrypted negotiation channel NC1 can be created based on short-range communication (such as the Bluetooth connection in the example above) established during device discovery / device listing.

[0159] For example, device 1 and device 2 achieve device discovery through a Bluetooth connection. Then, application module 1 can use this Bluetooth connection to create an encrypted negotiation channel NC1 with application module 2.

[0160] Understandably, the encryption negotiation channel NC1 can be configured with interfaces for both application module 1 and application module 2. Thus, application module 1 can transmit data to application module 2 by calling the interface of the encryption negotiation channel NC1 that faces application module 2. Similarly, application module 2 can transmit data to application module 1 by calling the interface of the encryption negotiation channel NC1 that faces application module 1.

[0161] Therefore, in some embodiments of this application, the information of channel NC1 may include the port information of channel NC1 facing the other end.

[0162] In some embodiments, application module 1 may store port information of the secure negotiation channel NC1 facing application module 2. Application module 2 may store port information of the secure negotiation channel NC1 facing application module 1.

[0163] S307, Application module 1 sends a connection request 32 to application module 2.

[0164] For example, the connection establishment request 32 may include at least one of the following:

[0165] Possible role information for device 1, and WIFI capability information for device 1.

[0166] Based on the foregoing description, the possible role information of device 1 may be related to the model and type of device 1. In some implementations, the possible role information of device 1 may be preset in device 1.

[0167] In other embodiments, the possible role information of device 1 may be determined by device 1 based on the basic WIFI parameters of device 1.

[0168] In this example, before executing S307, application module 1 can also obtain the current WIFI capability information of device 1 from link module 1.

[0169] The Wi-Fi capability information of device 1 may include at least one of the following: network card information of at least one network card of device 1, available channel information, and information on established Wi-Fi connections. This Wi-Fi capability information may be obtained by application module 1 from link module 1.

[0170] S308, Application module 2 sends a connection establishment reply 33 to application module 1.

[0171] For example, in conjunction with the description in S307, the connection response 33 may include possible role information of device 2, and / or WIFI capability information of device 2.

[0172] Based on the example in S307, application module 2 can obtain the latest WIFI capability information of device 2 from link module 2 before sending connection establishment reply 33.

[0173] S309, Application Module 1 determines P2P configuration 1.

[0174] In this example, P2P configuration 1 may include some parameters from the connection configuration of the P2P connection. For example, P2P configuration 1 may include the role information and frequency information of the P2P connection.

[0175] In some embodiments, the application module 1 may determine P2P configuration 1 based on at least one of the following: the basic WIFI parameters of device 1, the basic WIFI parameters of device 2, the possible role information of device 1, the WIFI capability information of device 1, the possible role information of device 2, and the WIFI capability information of device 2.

[0176] In other embodiments, application module 1 may also determine P2P configuration 1 based on the requirements of the current service (such as screen sharing service) for P2P connection (such as latency requirements, bandwidth requirements, etc.).

[0177] In this example, P2P configuration 1 indicates that device 1 is the GO.

[0178] S310, Application Module 1 sends P2P Configuration 1 to Link Module 1.

[0179] S311, Link Module 1 establishes a GO device according to P2P Configuration 1.

[0180] In this example, link module 1 can establish a GO device by using device 1 as the GO as indicated by P2P configuration 1, through the available network interface card (such as network interface card 0) of device 1.

[0181] In some implementations, link module 1 can create a Wi-Fi local area network through network card 0, based on the frequency information indicated by P2P configuration 1.

[0182] The parameters of this Wi-Fi local area network can include the SSID and password. Therefore, other GC devices (such as device 2) can access device 1's Wi-Fi local area network using this SSID and password, enabling device 1 to manage device 2 through P2P communication.

[0183] In this application, the SSID, password, and frequency information corresponding to GO are referred to as GO connection information.

[0184] S312, Link module 1 sends GO connection information to application module 1.

[0185] S313. Application module 1 generates IP and TCP port, and listens on the TCP port.

[0186] The IP address generated by application module 1 can correspond to device 1. Through this IP address, other devices (such as device 2) can uniquely identify device 1.

[0187] Application module 1 can allocate a TCP port upon receiving GO connection information (i.e., the GO device has been established) so as to receive TCP data from other devices by listening on that TCP port.

[0188] Therefore, application module 1 can encapsulate the IP, TCP port information, and GO connection information of device 1 into a data packet, which is also the connection configuration of the P2P connection determined by application module 1.

[0189] In this way, application module 1 generates (obtains) connection configurations such as GO connection information, device 1's IP information, and device 1's TCP port information for P2P connection.

[0190] S314, Application module 1 sends connection configuration C1 to application module 2.

[0191] For example, the connection configuration C1 may include at least one of the following: GO connection information, device 1's IP information, and device 1's TCP port information.

[0192] In some embodiments, application module 1 can send the connection configuration C1 through the established encrypted negotiation channel NC1.

[0193] S315, Application module 2 sends connection establishment instruction 34 to link module 2.

[0194] For example, in some embodiments, the connection establishment instruction 34 can be used to instruct the link module to perform P2P communication as a GC.

[0195] In other embodiments, the connection establishment instruction 34 may carry GO connection information. As described above, the GO connection information may include the SSID, password, and frequency information corresponding to the GO already established by device 1.

[0196] S316. Link module 1 and link module 2 establish a WI FIP2P physical link connection.

[0197] For example, link module 2 can access the GO already established by link module 1 based on the GO's connection information, including the GO's SSID, password, and frequency. It is understood that when link module 1 creates a GO, it can create a network similar to a hotspot (or local area network) based on the GO's connection information. Therefore, link module 2 can access the local area network created by device 1 based on the GO's connection information, realizing a Wi-Fi FIP2P physical link connection between devices.

[0198] In some implementations, link module 2 can use network card 0 of device 2 to establish a Wi-Fi FIP2P physical connection with link module 1.

[0199] S317, Link module 1 sends a connection success message to application module 1.

[0200] S318, Link Module 2 sends a connection success message to Application Module 2.

[0201] In this example, the link module in the device can report the successful connection to the application module of the device after successfully establishing the WI FIP2P physical link connection.

[0202] S319. Application module 1 and application module 2 establish a TCP encrypted channel.

[0203] For example, after establishing a Wi-Fi FIP2P physical link connection, application modules can establish a TCP encrypted channel based on the Wi-Fi FIP2P physical link connection to facilitate subsequent transmission of business data over this TCP encrypted channel.

[0204] In some embodiments, such as Figure 3 As shown, S319 may specifically include: application module 2 sending a TCP encrypted channel request 35 to application module 1. In some implementations, this TCP encrypted channel request 35 may be sent to device 1 based on device 1's IP address and TCP port information. Correspondingly, application module 1 sends a TCP encrypted channel establishment completion message to application module 2.

[0205] Thus, the TCP encrypted channel between the devices is established.

[0206] S320, Application Module 1 sends a connection success message to Smart Interconnection 1. This connection success message indicates that the TCP encrypted channel has been established.

[0207] S321. Application module 2 sends a connection success message to Smart Interconnection 2. This connection success message indicates that the TCP encrypted channel has been established.

[0208] Therefore, Smart Interconnection 1 and Smart Interconnection 2 can know that a TCP encrypted channel between the devices has been successfully established.

[0209] Subsequently, the smart interconnection of various devices can conduct P2P data transmission through shared interactive negotiation via the smart interconnection network. For example, smart interconnection 1 and smart interconnection 2 can transmit screen sharing service data through a TCP encrypted channel.

[0210] In some implementations, after establishing a TCP encrypted channel, Smart Connect 1 can also display the corresponding interface elements to the user to notify the user that screen sharing between device 1 and device 2 has been established.

[0211] Therefore, through such Figure 3 The scheme shown has the following characteristics: Figure 2 The two first devices (such as device 1 and device 2) shown can establish a P2P connection.

[0212] In some embodiments, the application module of the first device (such as device 1 or device 2) may also record the number of currently established connections by reference counting.

[0213] For example, such as Figure 3 As shown, after creating the encrypted negotiation channel NC1, application module 1 and application module 2 can update their respective connection counts. For example, application module 1 and application module 2 can each update the value of "MyP2PRef" to 1. This indicates that device 1 (or device 2) has established one communication connection.

[0214] After creating the TCP encrypted channel, application module 1 and application module 2 can each update their respective connection counts. For example, application module 1 and application module 2 can each update the value of "MyP2PRef" to 2. This indicates that device 1 (or device 2) has established two communication connections.

[0215] In some implementations, after establishing a TCP encrypted channel, Device 1 and Device 2 can release the encryption negotiation channel NC1, thereby saving corresponding communication resources. Correspondingly, Application Module 1 and Application Module 2 can update the value of "MyP2PRef" to 1. This indicates that Device 1 (or Device 2) has established one communication connection (i.e., a TCP encrypted channel).

[0216] And through such Figure 3 The scheme shown demonstrates that after establishing a P2P connection between device 1 and device 2, network interface card 0 of device 1 can be GO, and network interface card 0 of device 2 can be GC.

[0217] As mentioned above Figure 3The P2P connection logic shown allows the Wi-Fi link module in the framework layer to acquire and store the Wi-Fi capability information of device 1. The Wi-Fi link module can also report this Wi-Fi capability information to the connection application layer module in the application layer, so that the connection application layer module can determine the P2P configuration (e.g., P2P configuration 1) based on this Wi-Fi capability information and the basic Wi-Fi parameters of device 1.

[0218] The above combination Figure 2 and Figure 3 An example was given to illustrate the P2P connection establishment mechanism of the first device.

[0219] In some other embodiments of this application, the device performing P2P communication may also be a second device. The second device may have a different software configuration than the first device.

[0220] For example, refer to Figure 4 A schematic diagram of the composition of a second device is provided.

[0221] Combination Figure 2 A schematic diagram of the composition of the first device in the middle, as follows: Figure 4 In the example, the second device can also be configured with an application layer, a framework layer, a kernel layer, etc.

[0222] In such Figure 4 In the second device shown, the configurations of each module in the application layer are as follows: Figure 2 The first device shown is similar.

[0223] For example, the application layer of the second device can be configured with applications such as smart interconnection applications. The application layer may also include a connection application layer module (referred to as an application module). This application module may specifically be configured with a connection control module, a bridging module, a direct connection module, etc.

[0224] A Wi-Fi management module can be configured in the framework layer of the second device. The function of the Wi-Fi management module in the second device is similar to that in the first device.

[0225] In this example, the framework layer of the second device can also be configured with a Wi-Fi link module. This Wi-Fi link module may include a Wi-Fi protocol stack. Unlike the configuration in the first device, in this second device, the Wi-Fi link module may also include a Wi-Fi service module.

[0226] In this embodiment of the application, the WIFI service module of the second device can be used to support the WIFI link module's decision-making ability for P2P connection configuration.

[0227] For example, in some embodiments, the Wi-Fi service module can be used to obtain the basic Wi-Fi parameters and / or Wi-Fi capability information of the second device. In other embodiments, the Wi-Fi service module can also be used to determine the connection configuration corresponding to the frequency information, role information, and / or data transmission information of the P2P connection based on the Wi-Fi capability information, basic Wi-Fi parameters, and other information.

[0228] As can be seen, unlike the processing mechanism of the first device, in this second device, the Wi-Fi link module can make decisions on the connection configuration of the P2P connection through the Wi-Fi service module. Therefore, when establishing a P2P connection, the Wi-Fi link module in the second device can more efficiently determine the P2P configuration based on the perceived underlying Wi-Fi capability information, unlike in the first device where the Wi-Fi link module reports Wi-Fi capability information to the application module. This improves the accuracy and efficiency of P2P connection configuration decisions, and by decoupling the decision-making operation from the application module, it avoids redundant storage of data such as Wi-Fi capability information, and also saves data transmission overhead between the framework layer and the application layer.

[0229] In this application, the second device is equipped with a Wi-Fi service module, thus possessing the aforementioned ability to decide on P2P connection configurations at the framework layer. Correspondingly, this second device can also be described as supporting Wi-Fi service configuration. Devices whose Wi-Fi link modules do not have the ability to decide on P2P connection configurations (such as the first device) are considered not to support Wi-Fi service configuration.

[0230] In such Figure 4 In the example, the second device can also be configured with one or more network interface cards (NICs). For example, the second device can be configured with NIC 0, NIC 1, etc. NIC 0 and NIC 1 can correspond to different Wi-Fi chips, or NIC 0 and NIC 1 can correspond to two virtual NICs of the same Wi-Fi chip.

[0231] In this second device, each of the different network cards can be used to support one P2P connection.

[0232] Understandably, the second device can make more efficient decisions regarding P2P connection configuration through the Wi-Fi link module. This second device can also support the simultaneous operation of multiple network cards. For example, one P2P communication connection can be established through network card 0, while another P2P communication connection can be established through network card 1.

[0233] refer to Figure 5A This provides an interactive flowchart illustrating another method for establishing a P2P connection. In this example, both devices establishing the P2P connection can be, for example,... Figure 4 The second device shown. That is, as... Figure 5A Both devices 3 and 4 shown can be secondary devices. The connection configuration of the P2P connection can be determined by their respective link modules.

[0234] In this example, device 3 can be configured with Smart Connectivity 3 (corresponding to, for example, ...). Figure 4 The smart interconnected application shown), application module 3 (corresponding to, as shown) Figure 4 The connection application layer module shown), link module 3 (corresponding to, as shown) Figure 4 (The WIFI link module shown). A WIFI service module can be configured in this link module 3.

[0235] Accordingly, device 4 can be equipped with smart interconnection 4, application module 4, and link module 4. A Wi-Fi service module can be configured within link module 4.

[0236] like Figure 5A As shown, the method may include:

[0237] S501, Device 3 and Device 4 perform device discovery and bring the devices online.

[0238] S502, The user operates device 3 to initiate screen sharing to device 4.

[0239] S503 and Smart Interconnection 3 send connection call information 51 to application module 3.

[0240] S504, Application Module 3 and Application Module 4 create an encrypted negotiation channel NC2.

[0241] S505, Application Module 3 stores information from channel NC2.

[0242] S506, Application Module 4 stores information from channel NC2.

[0243] For example, the implementation of S501-S506 above can be referred to as follows: Figure 3 S301-S306 in the series.

[0244] like Figure 5A As shown in this example, after establishing the encrypted negotiation channel NC2, the application module in the device can further encapsulate NC2 as an auxiliary channel and register it with the link module. This allows the link module to transmit data to the application module via this auxiliary channel when it needs to communicate with the peer device. Correspondingly, the application module can use the encrypted negotiation channel NC2 to transmit this data to the application module of the peer device. Subsequently, the application module of the peer device can transmit this data to the link module via the auxiliary channel.

[0245] like Figure 5A As shown, the scheme may also include:

[0246] S507, Application Module 3 registers auxiliary channel AC21 with Link Module 3.

[0247] S508, Application Module 4 registers auxiliary channel AC22 with Link Module 4.

[0248] For example, auxiliary channel AC21 can be used for data transmission between application module 3 and link module 3. Auxiliary channel AC22 can be used for data transmission between application module 4 and link module 4.

[0249] After the negotiation channel is created, the application module 3 in device 3 can transmit the decision P2P connection configuration data to the link module 3 so that the link module 3 can perform subsequent processing.

[0250] S509, Application module 3 sends P2P connection establishment instruction 52 to link module 3.

[0251] For example, the P2P connection establishment instruction 52 can indicate that the link module 3 currently needs to establish a P2P connection with the device 4.

[0252] In this example, the P2P connection establishment indication 52 may also include QoS information for the current P2P service. For example, the P2P connection establishment indication 52 may include the bandwidth and latency requirements for the screen sharing service.

[0253] S510, Link Module 3 obtains P2P negotiation information 52.

[0254] For example, the P2P negotiation information 52 may include the link capability information 1 of device 1.

[0255] In this application, the link capability information may include at least one of the following: WIFI capability information, interference status, and bandwidth requirements.

[0256] In some embodiments, the link module 3 may update the WIFI capability information of device 1 upon receiving the P2P connection establishment instruction 52. As described above, the WIFI capability information of device 1 may include at least one of the following: network card information of at least one network card of device 1, available channel information, and information on established WIFI connections.

[0257] S511, Link module 3 sends P2P negotiation information 52 to application module 3.

[0258] For example, the link module 3 can send the P2P negotiation information 52 to the application module 3 through the auxiliary channel AC21.

[0259] S512, Application Module 3 encapsulates the P2P negotiation information 52, adds the first packet header, and obtains the connection establishment request information 53.

[0260] The application module 3 in the second device can send the negotiation information 52 to the peer device (such as device 4) to conduct negotiation during the P2P connection establishment process.

[0261] In this example, application module 3 can encapsulate the P2P negotiation information 52 generated by link module 3, add a first packet header (such as the Magiclink packet header), and obtain connection establishment request information 53. In this way, the peer device (such as device 4) can synchronously use the processing logic corresponding to the second device based on the received connection establishment request including the first packet header, and use the WIFI service module in the link module to make connection configuration decisions.

[0262] In some embodiments, a first header can be added to messages between link modules at the local application module. Correspondingly, when the peer receives a message including the first header, it can determine that the message can be processed by its local link module. Therefore, the peer's application module can remove the first header and forward the remaining valid data to the link module for further processing.

[0263] S513, Application module 3 sends a connection request message 53 to application module 4.

[0264] For example, the connection establishment request information 53 may include a first packet header and link capability information 1 of device 1.

[0265] In some embodiments, application module 3 can send the connection request information 53 through encrypted negotiation channel NC2.

[0266] S514, Application module 4 parses the header of connection establishment request information 53, and sends connection establishment request information 53 to link module 4 according to the first header.

[0267] For example, application module 4 can receive messages from device 1, such as receiving connection request information 53. Application module 4 can first parse the header of the connection request information 53 in order to determine the subsequent processing logic.

[0268] In this application, the application module can send the information, including the first header, to the link module for further processing upon receiving it. This ensures that when the second devices negotiate using the information carrying the first header, the information can be accurately transmitted to the link module, thereby enabling decisions on P2P connection configuration.

[0269] Correspondingly, the application module can continue parsing the subsequent content of the received information even if it does not include the first packet header. For example, combining... Figure 3 In the example, application module 2 of device 2 can directly parse the connection request 32 without adding the first header, without forwarding the information to the link module. In this way, when the first devices (or the first and second devices) negotiate using information without the first header, the information can be accurately and directly parsed and processed by the application module.

[0270] In this example, application module 4 can transmit the connection request information 53 to link module 4 through auxiliary channel AC22.

[0271] S515, Link module 4 obtains link capability information of device 4.

[0272] For example, link module 4 can receive connection establishment request information 53, thereby obtaining link capability information 1 of device 3. In conjunction with the foregoing description, through connection establishment request information 53, link module 4 can obtain the WIFI capability information, interference status, and bandwidth requirements of device 1.

[0273] Link module 4 can also update the link capability information 2 of device 4.

[0274] For example, the link capability information 2 may include the WIFI capability information of device 4, the current interference situation of device 4, etc.

[0275] The Wi-Fi capability information of device 2 may include network card information of at least one network card of device 2, available channel information, and information on established Wi-Fi connections.

[0276] S516 and Link Module 4 determine P2P Configuration 2 based on the link capability information of the two devices.

[0277] For example, P2P configuration 2 may include at least one item from the P2P connection configuration.

[0278] In some embodiments, P2P configuration 2 may include network card information used by device 4 (such as network card identifier), channel information available for P2P communication (such as 5G channel or 2.4G channel), etc.

[0279] As one possible implementation, link module 4 can select the 5G channel first when both devices have 5G channels available, based on link capability information 1 and link capability information 2.

[0280] As another possible implementation, link module 4 can determine the network interface card (NIC) capable of P2P communication based on link capability information 2, assuming device 4 includes multiple NICs. For example, if available NICs in device 4 include NIC 0 and NIC 1, NIC 0 will be used preferentially if it was established earlier or has more abundant communication resources.

[0281] Understandably, in some cases where all network cards / channels of device 4 are occupied, the P2P configuration 2 determined by link module 4 may also include information on whether to perform bridged communication or whether to preempt other network cards / channels that are already in communication.

[0282] In this example, we take the availability of network interface card 0 (NIC 0) on device 4 as an example. Therefore, P2P configuration 2 can include information about NIC 0 of device 4.

[0283] S517, Link module 4 sends P2P configuration 2 to application module 4. For example, link module 4 can send P2P configuration 2 to application module 4 through auxiliary channel AC22.

[0284] S518, Application Module 4 encapsulates P2P Configuration 2, adds the first packet header, and obtains connection establishment reply information 54.

[0285] Similar to the description in S512, application module 4 can add a first header to the message (such as P2P configuration 2) before sending the connection establishment reply information 54, so that the peer device can know that the message is used for the decision of the link module of the second device.

[0286] S519, Application module 4 sends connection establishment reply information 54 to application module 3.

[0287] For example, application module 4 can send connection establishment reply information 54 to application module 3 through encrypted negotiation channel NC2.

[0288] S520, Application Module 3 parses the header of Connection Response Message 54.

[0289] like Figure 5B As shown, after S520, the scheme may also include:

[0290] S521, Application module 3 sends connection establishment reply information 54 to link module 3.

[0291] Similar to the processing mechanism of S514, the application module 3 can execute S521 based on the connection establishment reply information 54 carrying the first packet header, and send the connection establishment reply information 54 to the link module 3 for connection configuration decision.

[0292] Correspondingly, link module 3 determines P2P configuration 3 based on connection establishment reply information 54.

[0293] For example, P2P configuration 3 may include: role information of the P2P connection and / or frequency information of the P2P connection. For instance, link module 3 can obtain link capability information 2 of device 4 based on connection establishment response information 54. According to preset rules and link capability information 1 of device 3, link module can determine whether the local machine or the peer is the GO.

[0294] In the following example, the local machine is used as the GO. That is, P2P configuration 3 includes information about the local machine as the GO.

[0295] S522, Link Module 3 establishes the GO device.

[0296] For example, if the link module 3 determines that the local machine is the GO, it can establish a local area network corresponding to the GO device so that the GC device can join the local area network for P2P communication.

[0297] Combination Figure 3 The description of S311 states that link module 3 can encapsulate information such as SSID, password, and usage frequency used when establishing the GO device into GO connection information.

[0298] S523, Link Module 3 sends a message to Application Module 3 that GO has been successfully created.

[0299] For example, the message indicating that the GO has been successfully created may include at least one of the following: information about the GO being used, network interface card information of the network card used, and the local IP address.

[0300] Understandably, in combination Figure 4 As explained in the documentation, the second device may be configured with multiple network interface cards (NICs). Therefore, the NIC used to create GO can be any of the available NICs in that second device.

[0301] In this way, the link module 3 can notify the application module 3 of the network card information of the GO device that has been created through the message of successful GO creation.

[0302] For example, link module 3 establishes the GO device through network interface card 0. Thus, the message indicating successful GO creation can include network interface card information from network interface card 0.

[0303] In some embodiments, the message indicating successful GO creation may also include a decision result, i.e., the connection configuration determined by the link module 3 after bilateral negotiation. For example, the message indicating successful GO creation may include information about the local machine as the GO.

[0304] The following example shows that the message indicating a successful GO creation includes the local machine as the GO and information about using network interface 0 as the GO.

[0305] In some embodiments, the message indicating successful GO creation may also include GO connection information. Specifically, this GO connection information may include the SSID, password, frequency, and other information used when creating the GO on network interface 0.

[0306] S524, Application Module 3 generates IP and TCP ports, and listens on the TCP ports.

[0307] For example, after creating GO, application module 3 can determine the TCP port to be used subsequently, and realize the transmission of subsequent business data by listening to the TCP port.

[0308] Therefore, device 3 can determine the connection configuration C2 used for the P2P connection. Connection configuration C2 may include GO connection information, device 3's device IP address, TCP port, etc.

[0309] S525, Application module 3 obtains connection configuration C2, adds the first packet header, and obtains configuration instruction information 55.

[0310] In this example, application module 3 can transmit TCP port, IP address, and other information to link module 3 via auxiliary channel AC21. Link module 3 can then encapsulate the TCP port, local IP address, and GO connection information into connection configuration C2.

[0311] Link module 3 can also send connection configuration C2 to application module 3. Application module 3 can then obtain this connection configuration C2.

[0312] Accordingly, application module 3 can add a first header to the connection configuration C2 to indicate to the peer device that the message can be parsed and processed by the link module.

[0313] S526, Application module 3 sends configuration instruction information 55 to application module 4.

[0314] S527, Application Module 4 receives configuration instruction information 55 and stores IP and TCP port.

[0315] In this example, application module 4 can determine to execute S528 based on the configuration instruction information 55 carrying the first packet header.

[0316] In some embodiments, application module 4 can also extract the IP address and TCP port information of device 3 based on preset fields. Thus, a TCP encrypted channel is established with device 3 based on the IP address and TCP port information of device 4.

[0317] S528, Application module 4 sends configuration instruction information 55 to link module 4.

[0318] S529, Link Module 4 parses configuration instruction information 55 and obtains GO connection information.

[0319] S530 and Link Module 4 establish a WI FIP2P physical link connection with Link Module 3 based on the GO connection information.

[0320] S531, Link module 3 sends a connection success message to application module 3. This connection success message indicates that the Wi-Fi FIP2P physical link with device 4 has been successfully connected.

[0321] S532, Link Module 4 sends a connection success message to Application Module 4. This connection success message indicates that the Wi-Fi FIP2P physical link with Device 3 has been successfully connected.

[0322] Application module 4 sends a TCP encrypted channel establishment request 56 to application module 3. For example, application module 4 can send a TCP encrypted channel establishment request 56 based on the IP address and TCP port of the peer device obtained in S527.

[0323] Application module 3 sends a message to application module 4 indicating that the TCP encrypted channel has been established.

[0324] Thus, the TCP encrypted channel between the devices is established.

[0325] Combination Figure 3 In the example above, after establishing the TCP encrypted channel, the application modules of both devices can send connection success information to their respective smart interconnection applications. This completes the establishment of the P2P connection between the second devices.

[0326] Subsequently, the smart interconnection applications of devices 3 and 4 can conduct smart interconnection network sharing and interactive negotiation to send P2P business data.

[0327] The smart interconnection application on device 3, which receives user input, can also display a notification on the interface indicating that a connection has been established. For example, it can display a message to the user stating, "Screen sharing from device 3 to device 4 has been established."

[0328] It should be noted that, in cases such as Figure 3 In the example, after the first device establishes a P2P connection, it can store information such as the number of P2P connections that have been established through connection counting. Since the first device generally does not have multiple network cards configured, this connection count information can correspond to the number of connections already established by the network cards configured in the first device (such as network card 0).

[0329] In such Figure 5A or Figure 5B The second device shown can be configured with multiple network cards to participate in multi-channel communication.

[0330] like Figure 5A or Figure 5B As shown, when P2P communication is established, the application modules of devices 3 and 4 can also record their respective connection information.

[0331] For example, consider device 3. The application module of device 3 can maintain a connection list. This connection list can include information about established P2P communications.

[0332] How Figure 5A or Figure 5B The illustrated scheme provides a process for establishing a P2P direct connection between devices 3 and 4. Device 3 can store "Direct Connection (Device 3 - Device 4)" information, indicating that the current direct connection communication may include a direct connection between devices 3 and 4. Furthermore, device 3 can also store "NIC 0: GO" information, indicating that NIC 0 of device 3 is currently in use and participating in communication as the GO role.

[0333] Similarly, device 4 can store "Direct Connection (Device 3 - Device 4)" information. This indicates that the current direct communication may include a direct connection between device 3 and device 4. Furthermore, device 4 can also store "NIC 0: GC" information. This indicates that NIC 0 of device 4 is currently in use and is participating in communication as a GC.

[0334] The above Figure 3 Two examples of schemes for establishing a direct connection with the first device are provided. Figure 5A and Figure 5B Two examples of schemes for establishing a direct connection with a second device are provided.

[0335] In other scenarios, the first and second devices can also establish P2P direct communication.

[0336] refer to Figure 6A Taking the example of a second device initiating a P2P direct connection communication to a first device, the second device can be device 3, and the first device can be device 1.

[0337] In this scenario, device 3 can be based on, for example... Figure 5A or Figure 5B The processing logic of the second device shown determines the connection configuration of the P2P connection through the link module 3.

[0338] Correspondingly, device 1 can be based on, for example... Figure 3 The processing logic of the first device shown determines the connection configuration of the P2P connection through application module 1.

[0339] Since device 3 establishes a direct P2P communication connection with device 1, in order for device 1 to interact normally with device 3, device 3 does not need to add a first packet header when sending messages to device 1. Thus, device 1 can process the information data without the first packet header according to... Figure 3 The logic shown is used for processing.

[0340] like Figure 6A As shown, the solution may include:

[0341] S601, Device 3 and Device 1 perform device discovery, and the device comes online.

[0342] S602, The user operates device 3 to initiate screen sharing to device 1.

[0343] S603, Smart Interconnection 3 sends connection call information 61 to Application Module 3.

[0344] S604, Application Module 3 and Application Module 1 create an encrypted negotiation channel NC3.

[0345] S605, Application Module 3 stores information in channel NC3.

[0346] S606, Application Module 1 stores information from channel NC3.

[0347] S607, Application Module 3 registers auxiliary channel AC31 with Link Module 3.

[0348] For example, the processing of S601-S607 can be referred to as follows: Figure 5A S501-S507 in the series.

[0349] Understandably, device 3, as the second device, can encapsulate the encrypted negotiation channel NC3 with device 1 into an auxiliary channel AC31 after establishing the NC3, and register it with link module 3. This allows link module 3 to subsequently interact with application module 3 and / or other devices through the auxiliary channel AC31.

[0350] S608, Application Module 3 determines the peer device as the first device.

[0351] For example, application module 3 can determine the peer device (such as device 1) as the first device based on the WIFI basic parameters of device 1.

[0352] In some embodiments, application module 3 can determine that device 1 is the first device based on the version information of application module 1 of device 1. That is, device 1 does not support WIFI service.

[0353] In this way, application module 3 can interact with device 1 according to the interaction logic of the first device during subsequent processing.

[0354] For example, when application module 3 receives information that needs to be sent to device 1, it does not need to add a first header to the information. Similarly, when application module 3 receives information from device 1 (such as application module 1 of device 1), it does not need to parse the header of the information and can directly forward the information to link module 3 through auxiliary channel AC31.

[0355] S609, Application module 3 sends P2P connection establishment instruction 62 to link module 3.

[0356] S610, Link Module 3 obtains P2P negotiation information 63.

[0357] For example, the P2P connection establishment instruction 62 can correspond to, for example, Figure 5A The P2P connection establishment instruction shown is 52.

[0358] In some embodiments, the P2P connection establishment indication 63 may include QoS information of the current P2P service.

[0359] P2P negotiation information 63 can correspond to, for example, Figure 5A The P2P negotiation information shown is 52.

[0360] In some embodiments, the P2P negotiation information 63 may include the link capability information 3 of the device 3.

[0361] The link capability information 3 of the device 3 may include at least one of the following: the device 3's WIFI capability information, interference status, and bandwidth requirements.

[0362] Taking link capability information 3, which includes the Wi-Fi capability information of device 3, as an example, the Wi-Fi capability information can indicate the available network cards of device 3 through network card information of at least one network card, available channel information, and information on established Wi-Fi connections.

[0363] In this example, if the available network interface card (NIC) of device 3 is not empty, in some implementations, the P2P negotiation information 63 may include information about the available NIC.

[0364] In some implementations, if device 3 has no available network cards (i.e., no available network cards), the P2P negotiation information 63 may also include the network card information of the first P2P network card (e.g., network card 0). Here, device 3 being the second device, having no available network cards, can correspond to all network cards being occupied.

[0365] S611, Link Module 3 sends P2P negotiation information 63 to Application Module 3 through Auxiliary Channel AC31.

[0366] S612, Application module 3 sends connection request information 64 to application module 1 through encrypted negotiation channel NC3.

[0367] In some embodiments, connection request information 64 may include negotiation information 63.

[0368] S613, Application module 1 sends connection establishment reply information 65 to application module 3.

[0369] Combination Figure 3 In the example scheme, after receiving the connection request information 64, the application module 1 of device 1 can send the WIFI capability information and / or possible role information of the local device (such as device 1) in the connection reply information 65 to the application module 3.

[0370] S614, Application module 3 forwards the connection establishment reply information 65 to link module 3.

[0371] S615 and link module 3 determine P2P configuration 3 based on connection establishment reply information 65.

[0372] In conjunction with the description in S521, the P2P configuration 3 may include role information and / or frequency information of the P2P connection.

[0373] In this example, the role information indicating device 3 (the local machine) included in P2P configuration 3 is used as the GO.

[0374] like Figure 6B As shown, S615 and later also include:

[0375] S616, Link Module 3 establishes the GO device.

[0376] S617, Link Module 3 sends a message to Application Module 3 that GO has been successfully created.

[0377] For example, the message indicating successful GO creation may include information about the local machine as the GO, the network interface card information of the local machine as the GO, the local machine's IP address, etc.

[0378] S618, Application Module 3 generates an IP address and a TCP port, and listens on the TCP port. Thus, Application Module 3 can obtain the TCP port number and IP information of the P2P connection to be created.

[0379] S619, Application Module 3 sends IP and TCP port information to Link Module 3.

[0380] S620, Link Module 3 encapsulates GO connection information, IP and TCP port information, and obtains connection configuration C3.

[0381] S621, Link module 3 sends connection configuration C3 to application module 3.

[0382] S622, Application module 3 sends connection configuration C3 to application module 1.

[0383] Therefore, device 3 can instruct device 1 to establish a P2P connection with device 3 by connecting to configuration C3.

[0384] S623, Application module 1 sends a connection establishment instruction 66 to link module 1.

[0385] For example, after receiving the connection configuration C3, application module 1 can parse the connection configuration C3 to obtain the GO connection information, IP and TCP port information of device 3.

[0386] In some embodiments, application module 1 may send GO connection information to link module 1 in connection establishment instruction 66.

[0387] S624, Link Module 1 and Link Module 3 establish a WI FIP2P physical link connection.

[0388] For example, link module 1 can join the local area network already created by device 3 based on the SSID, password, frequency, and other information indicated by the GO connection information of device 3, thereby realizing the establishment of a two-way WI FIP2P physical link connection.

[0389] In some embodiments, after establishing a Wi-Fi FIP2P physical link connection, link module 1 and link module 3 can send connection success information to the application module corresponding to their respective devices.

[0390] S625, Application Module 1 and Application Module 3 establish a TCP encrypted channel.

[0391] For example, application module 1 can send a TCP encrypted channel establishment request to application module 3 of device 3 based on the IP and TCP port information of device 3 carried in connection configuration C3.

[0392] Correspondingly, application module 3 can send a message to application module 1 indicating that the TCP encrypted channel has been established.

[0393] Therefore, both ends of the device can store information about the TCP encrypted channel (such as the port information of the peer device) respectively, so as to facilitate the subsequent transmission of business data through the TCP encrypted channel.

[0394] In some embodiments, after establishing a TCP encrypted channel, application module 1 and application module 3 can send connection success information to the smart interconnection application corresponding to their respective devices.

[0395] S626, Smart Interconnection 1, and Smart Interconnection 3 conduct smart interconnection network sharing and interactive negotiation.

[0396] Thus, device 3 can establish a P2P connection with device 1 upon user instruction. In some embodiments, device 3 can display corresponding prompts on the interface to inform the user of the current P2P connection establishment status. For example, device 3 can display the message "Screen sharing between device 3 and device 1 has been established".

[0397] Based on the foregoing description, after device 1 and device 3 establish a P2P connection, they can each maintain their own connection information through their respective application modules.

[0398] For example, let's take device 3 as an example. Device 3 can use the connection information of the connection list for P2P connections.

[0399] like Figure 6B As shown, the connection list for device 3 may include: "Direct Connection (Device 3 - Device 1); NIC 0: GO information". "Direct Connection (Device 3 - Device 1)" indicates that device 3 and device 1 have established a P2P direct communication (connection). "NIC 0: GO" indicates that in the established P2P connection, NIC 0 is used as the GO device for communication.

[0400] Take device 1 as an example. Device 1 can maintain connection information by using connection counting.

[0401] like Figure 6B As shown, the connection count information for device 1 may include "MyP2PRef = 2". Combined with... Figure 3 As explained, application module 1 of device 1 increments the connection count by 1 after establishing the encrypted negotiation channel NC3, i.e., MyP2PRef = 1. After establishing the TCP encrypted channel, the connection count increments by 1, i.e., MyP2PRef = 2. Since device 1 is only configured with one network interface card (e.g., network interface card 0), the value of this connection count represents the number of connections participated in by network interface card 0.

[0402] It should be noted that, as Figure 6A and Figure 6B In the implementation of the scheme shown, device 1 can adopt the logic corresponding to the first device (such as...). Figure 3 The logic shown) is used for data processing and interaction. Device 3 can internally employ the logic corresponding to the second device (such as...). Figure 5A or Figure 5BThe logic shown indicates that device 3 processes the data. However, during data interaction, device 3 can refer to the interaction logic of the first device, without needing to add a first header (parsing the first header) for data transmission. This allows the first device (such as device 1) to interact normally with the second device.

[0403] The above Figure 6A and Figure 6B The process of establishing a P2P connection is illustrated by taking the example of a second device initiating a P2P service to a first device.

[0404] refer to Figure 7A This provides a flowchart illustrating another P2P connection method. In this example, a P2P direct connection is initiated from a first device to a second device. The second device can be device 3, and the first device can be device 1.

[0405] Similar to Figure 6A and Figure 6B Examples of solutions in, such as Figure 7A In the scenario example, device 3 can be based on, for example... Figure 5A or Figure 5B The processing logic of the second device shown determines the connection configuration of the P2P connection through the link module 3.

[0406] Correspondingly, device 1 can be based on, for example... Figure 3 The processing logic of the first device shown determines the connection configuration of the P2P connection through application module 1.

[0407] Since device 3 establishes a direct P2P communication connection with device 1, in order for device 1 to interact normally with device 3, device 3 does not need to add a first packet header when sending messages to device 1. Thus, device 1 can process the information data without the first packet header according to... Figure 3 The logic shown is used for processing.

[0408] S701, Device 1 and Device 3 are detected, and the devices are online.

[0409] S702, User operates device 1 to initiate screen sharing to device 3.

[0410] S703, Smart Interconnection 1 sends connection call information 71 to Application Module 1.

[0411] S704, Application Module 1 and Application Module 3 create an encrypted negotiation channel NC4.

[0412] S705, Application Module 1 stores information from channel NC4.

[0413] S706, Application Module 3 stores information from channel NC4.

[0414] For example, the execution of S701-S706 can be referred to as follows: Figure 3 S301-S306 in the above will not be elaborated further.

[0415] S707, Application Module 3 registers auxiliary channel AC42 with Link Module 3.

[0416] In this example, device 3 can be a second device. That is, the P2P connection configuration of device 3 can be determined by link module 3.

[0417] In this example, after establishing the encrypted negotiation channel NC4, application module 3 can encapsulate NC4 into an auxiliary channel AC42 and register it with link module 3. This allows link module 3 to interact with application module 3 and other devices through the auxiliary channel AC42.

[0418] S708, Application module 1 sends a connection request message 72 to application module 3.

[0419] For example, the connection request information 72 may include possible role information of device 1, WIFI capability information of device 1, etc.

[0420] S709, Application Module 3 determines the peer device as the first device.

[0421] For example, application module 3 can determine the version information of application module 1 based on the basic Wi-Fi parameters of device 1. Then, based on the version information of application module 1, it can determine that the peer device is the first device.

[0422] Therefore, application module 3 can determine that it is not necessary to add the first header during subsequent interactions with device 1. It also does not need to parse and remove the first header after receiving a message.

[0423] S710, Application module 3 sends connection establishment request information 72 to link module 3.

[0424] According to the description in S709, if the peer device is determined to be the first device, the application module 3 may not process the received information (such as connection request information 72).

[0425] Since device 3 is the second device, application module 3 can forward connection request information 72 to chain module 3 for subsequent decision processing.

[0426] In this way, the link module 3 can determine the possible role information and WIFI capability information of device 1 based on the received connection request information 72.

[0427] S711, Link module 3 obtains link capability information 3 of device 3 and generates connection establishment reply message 73.

[0428] For example, link module 3 can obtain link capability information 3 of device 3. The link capability information 3 of device 3 may include at least one of the following: Wi-Fi capability information, interference status, and bandwidth requirements of device 3.

[0429] In some embodiments, the link module 3 can encapsulate the link capability information 3 into a connection establishment reply message 73. Thus, through this connection establishment reply message 73, the peer device can know the link capabilities of device 3.

[0430] In other embodiments, the link module 3 can make decisions based on the link capability information 3, the possible role information of device 1, and the Wi-Fi capability information of device 1, and encapsulate the possible role information and available Wi-Fi capabilities of device 3 in this P2P communication into a connection establishment reply message 73. In this way, when the peer device determines the P2P connection configuration based on the connection establishment reply message 73, it can combine the decision results of device 3 to more reasonably determine the P2P connection configuration.

[0431] S712, Link Module 3 sends Connection Establishment Reply Message 73 to Application Module 3.

[0432] S713, Application Module 3 sends a connection establishment reply message 73 to Application Module 1. It is understandable that, since Device 1 is the first device, there is no need to add a first header to the connection establishment reply message 73.

[0433] S714, Application Module 1 determines role information and frequency information based on connection reply message 73, with the local machine acting as GO.

[0434] S715, Application module 1 sends P2P configuration 1 to link module 1. For example, referring to the description in S309, P2P configuration 1 may include some parameters from the connection configuration of the P2P connection. For instance, P2P configuration 1 may include role information and frequency information for the P2P connection.

[0435] S716, Link Module 1 establishes a GO device. For example, Link Module 1 can establish a GO device based on the channel / frequency indicated by the frequency information. For instance, Link Module 1 can establish a local area network (LAN), whose parameters may include GO connection information such as SSID, password, and frequency / channel. Other devices can join the LAN through the GO connection information.

[0436] refer to Figure 7B Following the S716, this scheme may also include:

[0437] S717, Link Module 1 sends GO connection information to Application Module 1.

[0438] S718, Application Module 1 generates IP and TCP port, and listens on the TCP port.

[0439] S719, Application module 1 sends connection configuration C4 to application module 3. Connection configuration C4 may include GO connection information established by link module 1 for the GO device, device IP address of device 1, TCP port information, etc.

[0440] S720, Application module 3 obtains the peer's IP address and port number. For example, application module 3 can parse the received connection configuration C4 to obtain the peer's (e.g., device 1) IP address and TCP port number.

[0441] S721, Application module 3 sends connection configuration C4 to link module 3.

[0442] S722, Link Module 3 obtains GO connection information and decision results. For example, the decision results may include device 1's role as GO, and / or device 3's role as GC, and / or frequency information.

[0443] S723, Link Module 3 establishes a WI FIP2P physical link connection with Link Module 1. For example, Link Module 3 can access the LAN of the GO device through GO connection information, thereby establishing a WI FIP2P physical link connection with Link Module 1.

[0444] In some embodiments, the link module of the device can send a connection success message to the application module corresponding to its respective device after establishing a Wi-Fi FIP2P physical link connection.

[0445] S724, Application Module 3 sends a TCP encrypted channel establishment request to Application Module 1.

[0446] S725, Application module 1 sends a message to application module 3 indicating that the TCP encrypted channel has been established.

[0447] Therefore, application module 1 and application module 3 establish a TCP encrypted channel to facilitate the transmission of subsequent business data.

[0448] In some embodiments, application module 1 and application module 3 may respectively store information about the TCP encrypted channel (such as port information).

[0449] In some embodiments, after establishing a TCP encrypted channel, the application module of the device can send a connection success message to the smart interconnection application corresponding to its respective device.

[0450] S726, Smart Interconnection 1 and Smart Interconnection 2 conduct smart interconnection network sharing and interactive negotiation.

[0451] Therefore, through this Figure 7A and Figure 7B This solution enables the first device to establish a P2P connection with the second device under the user's instruction. Smart Interconnect 1 can then display the message "Screen sharing between device 1 and device 3 has been established" to the user.

[0452] When a P2P connection is established, each device can also save the corresponding connection information.

[0453] For example, application module 1 of device 1 can store the connection count MyP2PRef = 2. Application module of device 3 can store the connection list. The connection list can include information such as "Direct Connection (Device 1-Device 3), Network Interface Card 0: GC".

[0454] The above solutions provide methods for establishing P2P communication connections between first devices, between second devices, and between first and second devices. All the above scenarios use direct connection as an example. In other cases, multiple devices can also communicate via bridging.

[0455] For example, refer to Figure 8 This provides a schematic diagram of a scenario where multiple devices engage in P2P communication.

[0456] In such Figure 8 In the scenario shown, the devices communicating may include device A, device B, and device C.

[0457] Among them, device A, device B, or device C can be the first device or the second device.

[0458] Take the example of a direct link 1 already established between device A and device B.

[0459] In some implementations, when device C wants to establish P2P communication with device B, device B and device C can establish a direct link 2. The establishment of this direct link 2 can be due to: device B being a GO device in direct link 1; or device B being a GC device in direct link 1, and device B being a second device, and device B also having other network interface cards not used by direct link 1.

[0460] In other implementations, when device C wants to establish P2P communication with device B, device B and device C can establish a bridging link 3. The circumstances under which this bridging link 3 is established can include: in direct link 1, device B is the GC device, device B is the first device, or device B is the second device and device B has no other available network interface cards (NICs).

[0461] It is understandable that in multi-device scenarios involving both a first device and a second device, different devices use different protocols (such as the first protocol or the second protocol) for negotiation. Therefore, in situations such as... Figure 8 In the scenario shown, the establishment of P2P connections between multiple different types of devices is still worth exploring.

[0462] In order to enable the establishment of a P2P communication connection between device C and device B, this application embodiment also provides several P2P connection interaction methods, so that when device C and device B are the first device or the second device, the user can instruct the two devices to establish a P2P connection on device C or device B.

[0463] For example, in some scenarios, the initiating device C (i.e., the device receiving the user's operation) is a new, connectionless device (the second device), the receiving device B is a new device (the second device) with a P2P connection and the role of GC, and the GO device (device A) is an old protocol device (the first device). In this way, the initiating device C can initiate bridging negotiations for the new protocol (the second protocol) to device B. After receiving the bridging negotiation packet, device B can determine to switch from the new protocol to the old protocol for bridging based on the fact that the connected GO (device A) is an old device. Thus, device B can notify the initiating device C in its reply packet to device C to switch to the old protocol for bridging.

[0464] Correspondingly, if the initiating device is device B, the GO that has been connected can be considered an old device. Even if device C is a new device, the old protocol will still be used to perform bridging.

[0465] refer to Figure 9A This is a flowchart illustrating a P2P connection method. In this example, the devices participating in P2P communication may include two second devices (such as device 3 and device 4) and one first device (such as device 1).

[0466] Device 1 and Device 3 establish a direct P2P connection. Subsequently, Device 4, under user intervention, establishes a P2P connection with Device 3. If Device 4 has a usable network card while Device 3 does not, Device 4 cannot directly establish a direct P2P connection with Device 1. Therefore, Device 4 can communicate via... Figure 9A The scheme shown achieves P2P bridged communication between device 3 and device 1.

[0467] like Figure 9A As shown, the solution may include:

[0468] S901, User operates device 1 to initiate screen sharing to device 3.

[0469] Based on the aforementioned process description regarding direct connection between devices, in this example, before the user initiates screen sharing on devices 1 and 3, devices 1 and 3 can complete device discovery and online registration. Through this device discovery and online registration, devices 1 and 3 can obtain the basic Wi-Fi parameters of the other device. For example, these basic Wi-Fi parameters may include version information of the application module and / or link module of the other device. Based on this version information, it can be determined whether the other device is the first device or the second device.

[0470] S902, Device 1 and Device 3 perform P2P direct connection between the first device and the second device.

[0471] For example, device 1 and device 3 can be connected via, as shown in the example Figure 7A and Figure 7B The P2P direct connection between the first and second devices shown in the diagram executes S902 to realize P2P communication between device 1 and device 3.

[0472] In this example, after completing the P2P direct connection, application module 3 of device 3 can update the connection list to: "Direct Connection (Device 3 - Device 1), Network Interface Card 0: GC". This indicates that device 3 has established a P2P direct connection with device 1, and network interface card 0 of device 3 is working as GC.

[0473] Correspondingly, device 1 can record the current P2P connections using a connection count. For example, device 1's connection count can be updated to: "MyP2PRef = 1". In this example, we take the case where device 1 establishes a P2P connection with device 3 (e.g., after completing the Wi-Fi physical link connection and the establishment of the TCP encrypted channel) and then releases the previously established negotiated encrypted channel. Thus, after establishing a direct P2P connection with device 3, device 1 can establish one P2P communication with device 3 through its network interface card (e.g., network interface card 0) as the GO.

[0474] The following example illustrates how a user inputs an operation on device 4, instructing device 4 to establish P2P communication with device 1.

[0475] S903, User operation device 4 initiates network sharing to device 3.

[0476] Referring to the description in S901, in this example, prior to S903, device 4 can have already completed device discovery and device online with device 1. Thus, device 4 and device 3 can each obtain the basic Wi-Fi parameters of the other device.

[0477] S904 and Smart Interconnection 4 send connection call information 91 to application module 4.

[0478] For example, the connection call information 91 can be used to instruct application module 4 to establish a P2P connection with device 1. In some embodiments, the connection call information 91 may include QoS information of the current P2P service.

[0479] S905, Application Module 3 and Application Module 4 create an encrypted negotiation channel NC5.

[0480] In some embodiments, after receiving the connection call information 91 and before executing S905, the application module 4 can determine, based on the WIFI basic parameters of both ends (such as device 3 and device 4), whether the two ends meet the QoS information requirements of the current P2P service.

[0481] In this S905, the application module 4 can create channel NC5 with the application module 3 through the WIFI or Bluetooth negotiation channel established when the device 3 and the device 4 are discovering the device.

[0482] S906. Application module 3 stores information about channel NC5. For example, application module 1 can store the TCP port information of device 4 pointed to by channel NC5.

[0483] S907. Application module 4 stores information about channel NC5. For example, application module 4 may store the TCP port information of channel NC5 pointing to device 1.

[0484] S908, Application Module 3 registers auxiliary channel AC51 with Link Module 3.

[0485] S909, Application Module 4 registers auxiliary channel AC52 to Link Module 4.

[0486] In this example, devices 3 and 4, as second devices, can encapsulate channel NC5 as an auxiliary channel and register it with the link module after establishing channel NC5, so as to facilitate data transmission between link modules.

[0487] For example, device 4 is used as an example.

[0488] Device 4, as the second device, can make P2P connection configuration decisions through link module 4. In order for link module 4 to communicate smoothly with the peer device, application module 4 can encapsulate channel NC5 as an auxiliary channel and register it with link module 4. This allows link module 4 to send data to application module 4 through this auxiliary channel when it needs to send information to the peer device, and then application module 4 can send the data to the peer device according to channel NC5.

[0489] S910, Application module 4 determines the peer device as the second device. For example, application module 4 can determine the peer device (device 3) as the second device based on the version information of application module 3 in the WIFI basic parameters of device 3.

[0490] S911, Application module 4 sends P2P connection establishment instruction 92 to link module 4.

[0491] For example, the P2P connection establishment instruction 92 may include an identifier indicating that the peer device is a second device, and an instruction to establish a P2P connection with the peer device.

[0492] S912, Link Module 4 sends negotiation packet 93 to Application Module 4.

[0493] For example, the negotiation package 93 may include at least one of the following:

[0494] The negotiation packet 93 indicates the type ID of the request packet, the MAC address of device 4, the WIFI capability information of device 4, and the possible role information of device 4.

[0495] The Wi-Fi capability information of device 4 can be the Wi-Fi capability information updated by link module 4 from the network card driver of device 4. This Wi-Fi capability information may include at least one of the following: network card information of at least one network card of device 4, available channel information, and information on established Wi-Fi connections.

[0496] The possible role information for device 4 can be preset within device 4. In some implementations, this possible role information is related to the device type of device 4. For example, when device 4 is a laptop, its possible role information could be GO (Go). Conversely, when device 4 is a mobile phone or tablet, its possible role information could be no role (i.e., either GO or GC is acceptable).

[0497] In the following example, device 4 is assumed to have no role information.

[0498] In this example, link module 4 can send the negotiation packet 93 through auxiliary channel AC52.

[0499] S913, Application module 4 sends negotiation packet 93 to application module 3. For example, application module 4 can send negotiation packet 93 to application module 1 through channel NC5.

[0500] In some embodiments, the application module 4 may add a first header to the negotiation packet before sending the negotiation packet 93. The first header may be used to indicate that the negotiation packet is a negotiation packet based on the interaction between the second devices.

[0501] S914, Application Module 3 forwards negotiation packet 93 to Link Module 3.

[0502] In some embodiments, taking the negotiation packet 93 received by application module 3 as an example, which includes a first packet header, application module 3 can strip the first packet header and forward the negotiation packet 93 to link module 3, so that link module 3 can make relevant decisions on P2P connection configuration based on the negotiation packet 93.

[0503] S915, Link Module 3 generates reply packet 94.

[0504] In some embodiments, the response packet 94 may include possible role information of device 3, and / or WIFI capability information of device 3.

[0505] S916, Link Module 3 sends a reply packet 94 to Application Module 3.

[0506] S917, Application module 3 sends a reply packet 94 to application module 4.

[0507] In this example, we take device 3 as an example of GC in the already connected P2P communication. Thus, device 3 cannot establish another P2P connection with other devices through this already used network card.

[0508] Correspondingly, in other embodiments, if the established P2P communication is GO, device 3 can continue to use the network card to establish direct P2P connections with other devices (such as device 4). Thus, the electronic device can establish a P2P connection with device 4 through the direct P2P connection process between the second devices.

[0509] In some embodiments, application module 3 may add a first header to reply packet 94 before sending reply packet 94.

[0510] S918, Application Module 4 sends reply packet 94 to Link Module 4.

[0511] Taking the response packet 94 received by application module 4, which includes the first packet header, as an example.

[0512] Application module 4 can strip the first packet header to obtain reply packet 94. Application module 4 can then forward this reply packet 94 to link module 4.

[0513] S919, the link module 4 sends error code 95 to the application module 4. For example, error code 95 can be used to indicate that the two ends do not support direct connection and support initiating bridging.

[0514] In some embodiments, the link module 4 can determine, based on its own Wi-Fi capability information and the Wi-Fi capability information of the peer (e.g., device 3), that if its own network card is available but the peer's network card is not available, it can determine to establish a P2P connection through bridging. Correspondingly, the link module 4 can generate error code 95 so that the application module 4 is aware of the decision result.

[0515] S920, Application Module 4 makes a decision to determine whether to use an available network card on the local end to establish a bridge with the peer device.

[0516] For example, application module 4 can determine the information of the network card used for this P2P connection based on the decision result of link module 4. For instance, application module 4 can determine that the available network card 0 on the local end can establish P2P bridging communication with the peer end.

[0517] In some embodiments, application module 4 can encapsulate the available network interface card (NIC) information of the local end and / or the possible role information of the local end into a bridging request 96. For example, the available NIC information of the local end may include the NIC information of NIC 0, and the possible role information of the local end may include no role.

[0518] S921, Application module 4 sends a bridging request 96 to application module 3. For example, the bridging request 96 may include information indicating that the local device is a roleless device.

[0519] S922, Application Module 3 determines that a P2P connection already exists.

[0520] For example, in conjunction with S901-S902, the information of the existing P2P connection on this end may include: P2P direct connection between device 1 and device 3, where device 3 is GO.

[0521] In this way, application module 3 can determine that the first protocol needs to be used for P2P bridging based on the fact that this device is GC and the GO device is the first device.

[0522] Therefore, application module 3 can stop using the provisions corresponding to the second protocol to generate negotiation data, and instead use the provisions corresponding to the first protocol to generate negotiation data.

[0523] like Figure 9B As shown, after S922, this scheme may also include:

[0524] S923, Application module 3 sends bridging request 97 to device 1. Referring to the description in S922, in this example, bridging request 97 and subsequent data can be generated based on the first protocol (older protocol).

[0525] For example, bridging request 94 can be used to request a GO device (such as device 1) to assign an IP address to a roleless device (such as device 4). The newly assigned IP address can then be used by device 4 to establish P2P bridging communication with device 1 and device 3.

[0526] S924. Application module 1 determines that device 1 is the first device, device 3 is the second device, and device 4 (device without a role) is the second device.

[0527] S925, Application module 1 sends an IP allocation instruction to link module 1.

[0528] S926, Link Module 1 assigns an IP address to Device 4.

[0529] S927, Link Module 1 sends the IP address of Device 4 to Application Module 1.

[0530] S928, application module 1 encapsulates the GO connection information, the IP address of device 4, and the IP address and TCP port information of device 1 into a reply message 98. For example, the GO connection information can be the connection information of the local area network established by the GO when device 1 establishes a P2P direct connection with device 3. For instance, the GO connection information may include the SSID, password, frequency, and other information for accessing the GO (i.e., establishing a P2P physical link connection with device 1).

[0531] S929, Application module 1 sends a reply message 98 to application module 3.

[0532] S930, Application Module 3 stores the IP address of Device 4. This IP address of Device 4 can be a newly assigned IP address by Device 3. This IP address of Device 4 can be used by Device 1 and Device 4 to establish a smart interconnection network for sharing and negotiation.

[0533] S931, Application module 3 generates bridging request packet 98. For example, the bridging request packet 98 may include at least the IP address of device 3.

[0534] S932, Application module 3 sends a bridging request packet 98 to application module 4.

[0535] Referring to the description in S922, application module 3 can construct data using the first protocol, based on the GO device as the first device. In this example, application module 3 can include an identifier indicating a switch to the first protocol in the bridging request (including 98). This allows application module 4 to process received data based on the identifier corresponding to the first protocol, using the field positions and content requirements of the first protocol.

[0536] In some embodiments, application module 3 may add a first header to the bridging request packet 98 before sending the request packet 98 to application module 4. In other embodiments, since device 1, acting as the GO, is the first device, devices 3 and 4 may follow the interaction logic of the first device and send the bridging request packet 98 to application module 4 without adding the first header.

[0537] Understandably, for data carrying the first header, device 4 can parse and process it through link module 4. For data not carrying the first header, device 4 can parse and process it through application module 4.

[0538] In the following example, application module 1 sends a bridging request packet 98 directly without adding a first packet header.

[0539] S933, Application Module 4 stores the local IP, the IP of Device 1, and the IP of Device 3.

[0540] S934, application module 4 sends connection establishment instruction 99 to link module 4. This connection establishment instruction 99 can be used to instruct link module 4 to establish a Wi-Fi FIP2P physical link connection with link module 1. In some embodiments, the connection establishment instruction 99 may include the GO connection information of device 1.

[0541] S935, Link Module 4 and Link Module 1 establish a WI FIP2P physical link connection.

[0542] For example, link module 4 can join the local area network established by GO of device 1 based on GO connection information.

[0543] In some embodiments, after establishing a Wi-Fi FIP2P physical link connection, link module 4 and link module 1 can send connection success information to the application module of their respective devices.

[0544] S936, Application Module 4 establishes a TCP encrypted channel with Application Module 1.

[0545] For example, application module 4 can establish a TCP encrypted channel with device 1 based on the TCP port information of device 1.

[0546] In some embodiments, application module 4 and application module 1 can send connection success information to their respective devices' smart interconnection after establishing a TCP encrypted channel.

[0547] Taking the example of application module 4 sending a connection success message to smart interconnection 4, in some implementations, this connection success message may include the IP address of device 3.

[0548] S937, Smart Interconnection 4 and Smart Interconnection 3 conduct smart interconnection network sharing and interactive negotiation. For example, Smart Interconnection 4 and Smart Interconnection 3 can execute S937 based on the IP of the peer device.

[0549] After completing S903-S937 above, device 4 can establish P2P bridging communication with device 3 through device 1. Device 4 can respond to user input and display a message to the user indicating that device 4 has successfully initiated network sharing with device 3.

[0550] Thus, in application module 3 of device 3, the current connection information can be updated to: "Direct Connection (Device 3-Device 4), Direct Connection (Device 3-Device 1), Bridged Connection (Device 4-Device 3-Device 1), NIC 0: GC".

[0551] The direct connection (device 3 - device 1) can be a P2P direct connection established between device 3 and device 1 in S902. Device 3's network interface card 0 works as a GC.

[0552] A direct connection (Device 3 - Device 4) can be a P2P direct connection established between Device 3 and Device 4 during the bridging process (such as an established Wi-Fi FIP2P physical link connection, an established TCP encrypted channel, etc.). Device 3's network interface card 0 works as a GC.

[0553] A bridged connection (Device 4 - Device 3 - Device 1) can be used to bridge links between three devices. Device 3's network interface card 0 is used as a GC.

[0554] In application module 4 of device 4, the current connection information can be updated to: "Direct Connection (Device 1-Device 4), Bridged Connection (Device 3-Device 1-Device 4), NIC 0: GC". That is, device 4, as the GC, establishes a P2P direct connection with device 3, and establishes a P2P bridge with device 1 through device 3.

[0555] Device 1, as the first device, can update the connection count to MyP2PRef = 2.

[0556] refer to Figure 10A This is a schematic diagram of another type of P2P connection process. (The following is a separate, unrelated sentence.) Figure 10A The scenario shown illustrates a P2P connection established by three first devices. These three first devices can include device 1, device 2, and device 5.

[0557] like Figure 10A As shown, the solution may include:

[0558] S1001, The user operates device 1 to initiate screen sharing to device 2.

[0559] S1002, Device 1 and Device 2 perform a P2P direct connection between the first device.

[0560] For example, the execution of S1001-S1002 can be referred to as follows: Figure 3 Example of a solution.

[0561] Therefore, Device 1 and Device 2 can establish a P2P connection through their respective network cards. For example, let's take Device 1 as GO and Device 2 as GC.

[0562] Thus, application module 1 of device 1 can store the connection count MyP2PRef = 1. Application module 2 of device 2 can also store the connection count MyP2PRef = 1.

[0563] S1003, Device 1, Device 2 and Device 5 perform P2P connection status synchronization.

[0564] In this example, when device 5 is close to device 2, it can perform device discovery and device listing with device 2.

[0565] After device 5 and device 2 complete device discovery and come online, device 1, device 2 and device 5 can synchronize their respective connection status with other devices.

[0566] Through this P2P connection synchronization, device 1 can determine that device 2 has one connection and device 5 has no connection. Device 2 can determine that device 1 has one connection and device 5 has no connection. Device 5 can determine that both device 1 and device 2 have one connection each.

[0567] It is understandable that if devices 5 and 2 complete device discovery and device online before devices 1 and 2 establish a P2P connection, then if the connection status of devices 1 and 2 changes (such as completing S1002), S1003 can be triggered so that each device knows the connection status of other devices.

[0568] S1004, User operates device 2 to initiate network sharing to device 5.

[0569] S1005, Smart Interconnection 2 sends connection call information 131 to Application Module 2.

[0570] For example, the connection call information 131 may include QoS information of the current P2P service (such as network sharing).

[0571] S1006. Application module 2 determines that the local end is GC and device 5 has no connection, and executes the bridging process.

[0572] In some embodiments, the application module 2 may determine, based on the WIFI basic parameters of device 2 and device 5, that the two devices meet the QoS information requirements of the current P2P service, and then execute S1006.

[0573] In this example, after receiving a user's operation, application module 2 can determine, based on the established P2P connection, that device 2 is the GC in the connection with device 1.

[0574] Since device 2 is the first device, it is only configured with one network interface card (NIC, e.g., NIC 0), and this NIC 0 is used as a GC to communicate with device 1. Therefore, when device 2 needs to establish a P2P connection with device 5, it has no available NIC. Thus, device 2 can trigger the bridging process accordingly.

[0575] The bridging process may include the following steps S1007-S1017. Through this bridging process, device 2 can communicate with device 5 via device 1 through P2P. It is understood that since device 1 is the first device, the subsequent bridging process can be based on the first protocol.

[0576] S1007, Application module 2 sends a bridging request 132 to application module 1.

[0577] For example, the bridging request 132 can be used to request an IP address for a roleless device (such as device 5).

[0578] S1008, Application module 1 determines that device 1, device 2 and device 5 are all the first device.

[0579] Therefore, application module 1 can perform data transmission according to the interaction logic of each device, since each device is considered a first device. For example, it can omit or remove the first packet header.

[0580] S1009, Application module 1 sends IP allocation instruction 133 to link module 1.

[0581] Since device 1 is the first device, all decisions and configuration processes can be executed by application module 1. This step allows link module 1 to configure the new device 5 with a device IP address for accessing device 1.

[0582] S1010 and Link Module 1 assign IP addresses to Device 5.

[0583] like Figure 10B As shown, after S1010, the scheme may also include:

[0584] S1011, Link module 1 sends the IP address of device 5 to application module 1.

[0585] S1012, Application module 1 sends bridging response 134 to application module 2.

[0586] For example, the bridging response 134 may include GO connection information, the device IP of device 5, and the IP and TCP port information of device 1. The GO connection information may include the SSID, password, frequency, etc., of the local area network initiated by GO when device 1 connects to device 2.

[0587] S1013, Application module 2 sends bridging reply 134 to application module 5.

[0588] In some embodiments, application module 2 can directly forward the bridging response 134 to application module 5. In other embodiments, application module 2 can transmit the IP and / or TCP port information of device 2 to device 5 in addition to sending the bridging response 134.

[0589] S1014, Application module 5 sends connection establishment instruction 135 to link module 5.

[0590] Understandably, application module 5 can determine the GO connection information corresponding to device 1, the IP configured for device 5, and the IP and TCP port information of device 1 based on the received bridging response 134.

[0591] In this example, application module 5 can store the IP and TCP port information of device 1 so that a TCP encrypted channel can be established with device 1 based on this information.

[0592] As shown in S1014, application module 5 can also instruct link module 5 to establish a physical connection with link module 1 as a GC via connection establishment instruction 135. In some embodiments, connection establishment instruction 135 may include GO connection information in bridging response 134.

[0593] S1015, Link Module 5 and Link Module 1 establish a WI FIP2P physical link connection.

[0594] For example, link module 5 can join the local area network created by link module 1 as GO based on the GO connection information, thereby establishing a WI FIP2P physical link connection with link module 1.

[0595] In some embodiments, link module 5 may send connection success information to application module 5 after establishing the WI FIP2P physical link connection. Link module 1 may send connection success information to application module 1 after establishing the WI FIP2P physical link connection.

[0596] S1016. Application module 1 and application module 5 establish a TCP encrypted channel.

[0597] For example, application module 1 and application module 5 can establish the TCP encrypted channel based on the peer device IP and the established Wi-Fi IP2P physical link connection. After the TCP encrypted channel is established, both devices can save the TCP encrypted channel information respectively.

[0598] In some embodiments, application module 5 can send a connection success message to smart interconnection 5 after establishing the Wi-Fi FIP2P physical link connection. Application module 1 can send a connection success message to smart interconnection 1 after establishing the Wi-Fi FIP2P physical link connection.

[0599] In some embodiments, after completing the TCP encrypted channel, application module 5 can send a bridging success message to application module 2. This bridging success message may carry the device IP address of device 5. Correspondingly, application module 2 can send connection success information to smart interconnection 2. This connection success information may include the device IP address of device 5.

[0600] S1017, Device 2 and Device 5 perform intelligent interconnection network sharing and interactive negotiation.

[0601] For example, the smart interconnection 2 of device 2 and the smart interconnection 5 of device 5 can respectively achieve smart interconnection network sharing and interactive negotiation through the peer's IP. In some embodiments, the data packets in this negotiation process can be forwarded to the peer device through device 1.

[0602] Thus, device 2 can establish P2P bridged communication with device 5 based on the existing P2P connection with device 1. Correspondingly, each device can update its connection count separately. For example, the updated connection count for device 1 might include "MyP2PRef = 2". Similarly, the updated connection count for device 2 might include "MyP2PRef = 2". And for device 5, the updated connection count might include "MyP2PRef = 1".

[0603] It is understandable that, such as Figure 10A and Figure 10B In the example, let's take the establishment of P2P communication between device 5 and device 2, which acts as a GC, as an example. Since device 2 is a GC, it can only establish bridged communication with device 5 through device 1, which acts as a GO. In other embodiments, when device 5 establishes P2P communication with device 1, which acts as a GO, since device 1's network card communicates as a GO, it can connect to multiple GCs simultaneously. Therefore, device 5 can establish a first-device P2P communication with device 1 as a GC.

[0604] refer to Figure 11AThis is a schematic diagram of another type of P2P connection process. In this example, P2P communication is established using three second devices. These three second devices can include device 3, device 4, and device 6.

[0605] In this example, device 3 can establish a direct P2P connection with device 4. Device 4 can establish P2P communication with device 6 upon user instruction. However, after establishing a direct connection with device 3, all network cards of device 4 are occupied, preventing it from establishing a direct P2P connection with device 6. Thus, device 4 can communicate via... Figure 11A The process shown enables P2P bridging communication with device 6 through bridging of device 3.

[0606] For example, such as Figure 11A As shown, the solution may include:

[0607] S1101, The user operates device 3 to initiate screen sharing to device 4.

[0608] S1102, Device 3 and Device 4 perform a P2P direct connection between the second device.

[0609] For example, the execution of this process can be referred to as follows: Figure 5A The explanations shown will not be repeated here.

[0610] Therefore, network interface card 0 of device 3 can act as the GO (Go) to establish a direct P2P communication connection with device 4. Meanwhile, network interface card 0 of device 4 can act as the GC (GC) to communicate with device 3. This example assumes that device 4 has no other available network interface cards.

[0611] S1103, User operation device 4 initiates network sharing to device 6.

[0612] For example, prior to S1103, device 4 can perform device discovery and device online with device 6. In this way, device 4 and device 6 can each obtain the Wi-Fi basic parameters of the peer device. The Wi-Fi basic parameters may include the version information of the peer device's application module / link module. The version information of the application module / link module of the first device and the second device is different.

[0613] S1104, Application module 4 sends connection call information 111 to link module 4.

[0614] The connection call information 111 may include QoS information for the current P2P service (such as network sharing service).

[0615] S1105, Application Module 4 and Application Module 6 create an encrypted negotiation channel NC6.

[0616] S1106, Application Module 4 stores information in channel NC6.

[0617] S1107, Application Module 6 stores information in channel NC6.

[0618] S1108, Application Module 4 registers auxiliary channel AC61 to Link Module 4.

[0619] S1109, Application module 6 registers auxiliary channel AC62 with link module 6.

[0620] In this example, both device 4 and device 6 are secondary devices. During the P2P connection establishment process, after establishing channel NC6, the application modules within each device can encapsulate channel NC6 as an auxiliary channel and register it with the link module. This enables communication between the link modules of different devices.

[0621] S1110, Application module 4 determines the peer device as the second device. For example, application module 4 can determine device 6 as the second device based on the basic WIFI parameters of the peer device.

[0622] S1111, Application module 4 sends P2P connection establishment instruction 112 to link module 4.

[0623] For example, the P2P connection establishment instruction 112 may include an identifier indicating that the peer device is a second device, and an instruction to establish a P2P connection with the peer device.

[0624] S1112, Link Module 4 and Link Module 6 have the ability to interact with dual-end channel network cards.

[0625] For example, the two link modules can achieve two-way interaction through an auxiliary channel. Through this two-way channel network interface card capability, link module 4 can obtain the Wi-Fi capability information and possible role information of device 6. Correspondingly, link module 6 can obtain the Wi-Fi capability information and possible role information of device 4.

[0626] S1113 and Link Module 4 determine that there is no available network card on this end, but there is a available network card on the other end.

[0627] For example, link module 4 can determine, based on its own Wi-Fi capability information and the other end's Wi-Fi capability information, that there is no available network card on its end, but there is a available network card on the other end. Therefore, link module 4 can determine to establish bridged communication with device 6.

[0628] S1114, Link Module 4 sends error code 113 to Application Module 4. Error code 113 can be used to indicate the establishment of bridged communication with the peer device.

[0629] S1115, Application module 4 sends bridging instruction information 114 to application module 6.

[0630] For example, the bridging indication information 114 may include at least one of the following: available network interface card information of device 4 (such as network interface card information of network interface card 0), decision information of device 6 as GC, network interface card information of network interface card 0 of device 3 as GO, and MAC address of device 3.

[0631] S1116, Application module 6 sends bridging instruction information 114 to link module 6.

[0632] S1117, Link module 6 generates negotiation packet 115 based on bridging instruction information 114.

[0633] For example, the negotiation package 115 may include updated Wi-Fi capability information of device 6, as well as possible role information.

[0634] S1118, Link module 6 sends negotiation packet 115 to application module 6.

[0635] S1119, Application module 6 adds the first header to negotiation packet 115 and obtains negotiation packet 116.

[0636] like Figure 11B As shown, after S1119, it may also include:

[0637] S1120, Application module 6 sends negotiation packet 116 to application module 3.

[0638] S1121, Application module 3 strips the first packet header and obtains negotiation packet 115.

[0639] S1122, Application module 3 sends negotiation packet 115 to link module 3.

[0640] S1123, Link module 3 decides to establish a WI FIP2P direct connection between its local GO and the peer GC, generating a reply packet 116. For example, this reply packet 116 may include GO connection information, device 3's IP and TCP port information, etc.

[0641] S1124, Link module 3 sends reply packet 116 to application module 3.

[0642] S1125, Application module 3 adds the first header to reply packet 116 and obtains reply packet 117.

[0643] S1126, Application module 3 sends reply packet 117 to application module 6.

[0644] S1127, Application module 6 strips the first packet header and obtains reply packet 116.

[0645] S1128, Application module 6 sends reply packet 116 to link module 6.

[0646] In this way, application module 6 of device 6 can know the IP and TCP port information of device 3, and use it to establish a TCP encrypted channel with device 3. Link module 6 of device 6 can know the GO connection information of device 3, and use it to establish a Wi-Fi IP2P physical link connection with device 3.

[0647] S1129, Link Module 6 and Link Module 3 establish a WI FIP2P physical link connection.

[0648] In some embodiments, link module 6 and link module 3 can send connection success information to their respective application modules after establishing a Wi-Fi FIP2P physical link connection.

[0649] S1130, Application Module 6 and Application Module 3 establish a TCP encrypted channel.

[0650] In some embodiments, application module 6 and application module 3 can send connection success information to their respective devices' smart interconnection after establishing a TCP encrypted channel.

[0651] S1131, Smart Interconnect 6 and Smart Interconnect 4 conduct smart interconnect network sharing and interactive negotiation. For example, Smart Interconnect 6 and Smart Interconnect 4 can execute S1131 based on the IP of the peer device.

[0652] After completing steps S1103-S1131 above, device 4 can establish P2P bridging communication with device 3 through device 6. Device 4 can respond to user input by displaying a message indicating that the network sharing between device 4 and device 6 has been successfully initiated.

[0653] Thus, in application module 3 of device 3, the current connection information can be updated to: "Direct Connection (Device 3-Device 4), Direct Connection (Device 3-Device 6), Bridged Connection (Device 4-Device 3-Device 6) NIC 0: GO".

[0654] In application module 4 of device 4, the current connection information can be updated to: "Direct Connection (Device 3-Device 4), Bridged Connection (Device 4-Device 3-Device 6), NIC 0: GC".

[0655] In application module 6 of device 6, the current connection information can be updated to: "Direct Connection (Device 3-Device 6), Bridged Connection (Device 4-Device 3-Device 6), NIC 0: GC".

[0656] It is understood that the electronic device provided in this application embodiment includes hardware structures and / or software modules corresponding to perform each function in order to achieve the above-mentioned functions. Those skilled in the art should readily recognize that, in conjunction with the units and algorithm steps of the various examples described in the embodiments disclosed herein, the embodiments of this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of this application.

[0657] This application embodiment can divide the above-described electronic device into functional modules based on the method example described above. For example, each function can be divided into its own functional modules, or two or more functions can be integrated into one processing module. The integrated modules can be implemented in hardware or as software functional modules. It should be noted that the module division in this application embodiment is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.

[0658] The foregoing mainly describes the solutions provided by the embodiments of this application from the perspective of various functional modules. Those skilled in the art should readily recognize that, based on the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0659] The integrated modules described above can be implemented in hardware or as software functional modules. It should be noted that the module division in this embodiment is illustrative and represents only one logical functional division; in actual implementation, other division methods may be used.

[0660] For example, Figure 12 A schematic diagram of the composition of an electronic device 1200 is shown. (As shown) Figure 12As shown, the electronic device 1200 may include a processor 1201 and a memory 1202. The memory 1202 is used to store computer execution instructions. Exemplarily, in some embodiments, when the processor 1201 executes the instructions stored in the memory 1202, the electronic device 1200 may perform any of the methods shown in the above embodiments. In some implementations, the electronic device 1200 may be the first device described above. In other implementations, the electronic device 1200 may be the second device described above.

[0661] It should be noted that all relevant content of each step involved in the above method embodiments can be referenced from the functional description of the corresponding functional module, and will not be repeated here.

[0662] Figure 13 A schematic diagram of a chip system 1300 is shown. The chip system 1300 may include a processor 1301 and a communication interface 1302, used to support related devices in implementing the functions involved in the above embodiments. In one possible design, the chip system also includes a memory for storing necessary program instructions and data of the electronic device. The chip system may be composed of chips or may include chips and other discrete devices. It should be noted that in some implementations of this application, the communication interface 1302 may also be referred to as an interface circuit. For example, the chip system 1300 may be disposed in any of the aforementioned first devices to support the first device in executing a P2P connection according to the logic corresponding to the first device. Alternatively, the chip system 1300 may be disposed in any of the aforementioned second devices to support the second device in executing a P2P connection according to a corresponding method.

[0663] It should be noted that all relevant content of each step involved in the above method embodiments can be referenced from the functional description of the corresponding functional module, and will not be repeated here.

[0664] This application also provides a computer-readable storage medium storing a computer program thereon. When executed by a computer, the computer program implements the method flow related to the electronic device in any of the above method embodiments. Specifically, the computer can be the first device or the second device described above.

[0665] This application also provides a computer program or a computer program product including a computer program, which, when executed on a computer, causes the computer to implement the method flow related to the electronic device in any of the above method embodiments. Specifically, the computer can be the first device or the second device described above.

[0666] In this application, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this embodiment, unless otherwise stated, "a plurality of" means two or more.

[0667] The functions, actions, operations, or steps in the above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any combination thereof. When implemented using software programs, they can be implemented, in whole or in part, in the form of a computer program product. This computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or include one or more data storage devices such as servers and data centers that can be integrated with the medium. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state disks (SSDs)).

[0668] Although this application has been described in conjunction with specific features and embodiments, it is obvious that various modifications and combinations can be made thereto without departing from the scope of this application. Accordingly, this specification and drawings are merely exemplary illustrations of the application as defined by the appended claims, and are considered to cover any and all modifications, variations, combinations, or equivalents within the scope of this application. Clearly, those skilled in the art can make various alterations and modifications to this application without departing from the scope of this application. Thus, if such modifications and modifications of this application fall within the scope of the claims of this application and their equivalents, this application is also intended to include such modifications and modifications.

Claims

1. A P2P connection method, characterized in that, The method is applied to a third electronic device. The second electronic device and the first electronic device have established a first P2P connection, and the method is used for the third electronic device to establish a P2P connection with the second electronic device. Both the third electronic device and the second electronic device are of the second type of device. The framework layer of the second type of device is provided with a link module. The link module is used to determine the P2P connection configuration of the second type of device. The P2P connection configuration includes at least one of the following: GO / GC role information, network card information used, and frequency information for P2P communication. The first electronic device is a first type of device, and the application layer of the first type of device is provided with an application module, which is used to decide the P2P connection configuration of the first type of device. The method includes: Receive a first operation from the user, the first operation being used to instruct the second electronic device to establish a P2P connection with the third electronic device; The third electronic device sends a first negotiation packet to the second electronic device. The first negotiation packet includes the WIFI capability information of the third electronic device. The WIFI capability information includes at least one of the following: the identifier, model, and available channel of at least one network card, and information on the WIFI connections already established by the local device. Receive a first response packet, which includes the WIFI capability information of the second electronic device; Based on the WIFI capability information of the second electronic device and the WIFI capability information of the third electronic device, the link module of the third electronic device establishes P2P bridge communication with the second electronic device.

2. The method according to claim 1, characterized in that, After receiving the first operation, the method further includes: The smart interconnection application of the third electronic device sends a first connection call to the application module of the third electronic device, and the first connection call includes information of P2P communication corresponding to the first operation. The application module of the third electronic device establishes a first encrypted negotiation channel with the application module of the second electronic device. The first encrypted negotiation channel is used for data transmission between the application module of the second electronic device and the application module of the third electronic device. The application module of the third electronic device registers a first auxiliary channel with the link module of the third electronic device. The first auxiliary channel is used for data transmission between the link module of the third electronic device and the application module of the third electronic device.

3. The method according to claim 1 or 2, characterized in that, The method further includes: The application module of the third electronic device sends a first connection establishment instruction to the link module of the third electronic device. The first connection establishment instruction is used to indicate that the second electronic device is a second type of electronic device. The first connection establishment instruction also instructs the link module of the third electronic device to establish a P2P connection with the second electronic device. In response to the first connection establishment instruction, the link module of the third electronic device generates the first negotiation packet.

4. The method according to any one of claims 1-3, characterized in that, After receiving the first reply packet, the method further includes: The link module of the third electronic device determines, based on the WIFI capability information of the second electronic device and the WIFI capability information of the third electronic device, that there is a usable network card on its own end and that the second electronic device does not have a usable network card, and establishes a P2P connection with the second electronic device using P2P bridging communication.

5. The method according to claim 4, characterized in that, The method further includes: The link module of the third electronic device sends a first error code to the application module of the third electronic device. The first error code is used to indicate the establishment of P2P bridge communication with the second electronic device. The application module of the third electronic device sends a first bridging request to the application module of the third electronic device. The first bridging request includes the available network card information of the third electronic device and / or the role information of the second electronic device. The first bridging request is used by the second electronic device to determine the connection configuration for establishing P2P bridging communication with the third electronic device.

6. The method according to any one of claims 1-5, characterized in that, The method further includes: Receive a second bridging request, the second bridging request including at least one of the following: GO connection information of the first electronic device, IP of the third electronic device, IP and TCP port information of the first electronic device, and IP of the second electronic device; Based on the GO connection information in the second bridging request, the third electronic device establishes a WIFIP2P physical link connection with the first electronic device; Based on the IP and TCP port information of the first electronic device in the second bridging request, the third electronic device establishes a TCP encrypted channel with the first electronic device; Based on the IP address of the second electronic device in the second bridging request, the third electronic device establishes a smart interconnection network sharing and interactive negotiation with the second electronic device.

7. A P2P communication method, characterized in that, The method is applied to a second electronic device. The second electronic device and the first electronic device have established a first P2P connection, and the method is used for the third electronic device to establish a P2P connection with the second electronic device; Both the third electronic device and the second electronic device are of the second type of device. The framework layer of the second type of device is provided with a link module. The link module is used to determine the P2P connection configuration of the second type of device. The P2P connection configuration includes at least one of the following: GO / GC role information, network card information used, and frequency information for P2P communication. The first electronic device is a first type of device, and the application layer of the first type of device is provided with an application module, which is used to decide the P2P connection configuration of the first type of device. The method includes: The device receives a first negotiation packet from the third electronic device. The first negotiation packet includes the WIFI capability information of the third electronic device. The WIFI capability information includes at least one of the following: the identifier, model, and available channel of at least one network card, and information on the WIFI connections already established by the local device. Send a first reply packet, which includes the WIFI capability information of the second electronic device; A first bridging request is received, the first bridging request including the available network card information of the third electronic device and / or the role information of the second electronic device; the first bridging request is used by the second electronic device to determine the connection configuration for establishing P2P bridging communication with the third electronic device; Send a second bridging request, the second bridging request including at least one of the following: the GO connection information of the first electronic device, the IP of the third electronic device, the IP and TCP port information of the first electronic device, and the IP of the second electronic device; If the third electronic device successfully bridges with the first electronic device, the second electronic device and the third electronic device perform intelligent interconnection network sharing and interaction negotiation.

8. The method according to claim 7, characterized in that, The successful bridging of the third electronic device with the first electronic device includes: The third electronic device establishes a WIFIP2P physical link connection and a TCP encrypted channel with the first electronic device.

9. The method according to claim 7 or 8, characterized in that, Before receiving the first negotiation packet, the method further includes: The application module of the second electronic device establishes a first encryption negotiation channel with the application module of the third electronic device. The first encryption negotiation channel is used for data transmission between the application module of the second electronic device and the application module of the third electronic device. The application module of the second electronic device registers a second auxiliary channel with the link module of the second electronic device. The second auxiliary channel is used for data transmission between the link module of the second electronic device and the application module of the second electronic device.

10. The method according to any one of claims 7-9, characterized in that, Receiving the first negotiation packet includes: The application module of the second electronic device receives the first negotiation packet, and then sends the second negotiation packet to the link module of the second electronic device through the first auxiliary channel. The link module of the second electronic device generates the first response packet based on the first negotiation packet.

11. The method according to any one of claims 7-10, characterized in that, After receiving the first bridging request, the method further includes: A third bridging request is sent to the first electronic device, the third bridging request being used to request the first electronic device to allocate an IP address to the third electronic device; Receive a third response message, the third response message including at least one of the following: The IP address of the third electronic device, the GO connection information of the first electronic device, and the IP address and TCP port information of the first electronic device; the GO connection information includes at least the SSID and password corresponding to the GO of the first electronic device.

12. The method according to claim 11, characterized in that, The method further includes: Based on the third reply message, store the IP address of the third electronic device; Generate the second bridging request.

13. The method according to claim 12, characterized in that, Generating the second bridging request includes: The second bridging request is generated based on the IP address of the second electronic device and the third response message.

14. The method according to claim 12 or 13, characterized in that, The second electronic device and the third electronic device perform intelligent interconnection network sharing and interaction negotiation, including: The smart interconnection application of the second electronic device performs network sharing and interaction negotiation with the smart interconnection application of the third electronic device based on the IP of the third electronic device.

15. A P2P connection method, characterized in that, The method is applied to the first electronic device. The second electronic device and the first electronic device have established a first P2P connection, and the method is used for the third electronic device to establish a P2P connection with the second electronic device. Both the third electronic device and the second electronic device are of the second type of device. The framework layer of the second type of device is provided with a link module. The link module is used to determine the P2P connection configuration of the second type of device. The P2P connection configuration includes at least one of the following: GO / GC role information, network card information used, and frequency information for P2P communication. The first electronic device is a first type of device, and the application layer of the first type of device is provided with an application module, which is used to decide the P2P connection configuration of the first type of device. The method includes: Receive a third bridging request, the third bridging request being used to request the first electronic device to allocate an IP address to the third electronic device; A third reply message is sent, the third reply message including an IP address assigned to the third electronic device; the IP address of the third electronic device is used by the third electronic device to establish P2P bridging communication with the second electronic device.

16. The method according to claim 15, characterized in that, The third reply message also includes at least one of the following: The GO connection information of the first electronic device, and the IP and TCP port information of the first electronic device; the GO connection information includes at least the SSID and password corresponding to the GO of the first electronic device.

17. The method according to claim 15 or 16, characterized in that, The receiving of the third bridging request includes: The application module of the first electronic device receives a bridging request from the second electronic device; After receiving the third bridging request, the method further includes: The application module of the first electronic device sends a first IP allocation instruction to the link module of the first electronic device; The link module of the first electronic device sends the IP address allocated to the third electronic device to the application module of the first electronic device according to the first IP allocation instruction; The third reply message is generated based on the IP address of the third electronic device, the GO connection information of the first electronic device, and the IP address and TCP port information of the first electronic device.

18. An electronic device, characterized in that, The electronic device includes: a memory and one or more processors; the memory and the processors are coupled. The memory is used to store computer program code, which includes computer instructions. When the processor executes the computer instructions, the electronic device performs the method as described in any one of claims 1-6, or performs the method as described in any one of claims 7-14, or performs the method as described in any one of claims 15-17.

19. A chip system, characterized in that, The chip system is applied to an electronic device; the chip system includes one or more interface circuits and one or more processors; the interface circuits and the processors are interconnected via lines; the interface circuits are used to receive signals from the memory of the electronic device and send the signals to the processors, the signals including computer instructions stored in the memory; when the processor executes the computer instructions, the electronic device performs the method as described in any one of claims 1-6, or performs the method as described in any one of claims 7-14, or performs the method as described in any one of claims 15-17.

20. A computer-readable storage medium, characterized in that, The method includes computer instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of claims 1-6, or the method as described in any one of claims 7-14, or the method as described in any one of claims 15-17.