Multi-Device Multi-Port Connection Method, System, Electronic Device, and Storage Medium

Through a unified port selection mechanism and long connection technology, the port connection stability problem between multiple devices is solved, and flexible and stable multi-device and multi-port connection is achieved, avoiding the impact of firmware.

CN115514798BActive Publication Date: 2025-07-11INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211047356.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-29
Publication Date
2025-07-11
Estimated Expiration
2042-08-29

AI Technical Summary

Technical Problem

The prior art is difficult to effectively realize the connection of multiple ports between multiple devices, especially under the influence of device firmware.

Method used

Through a unified port selection mechanism, long connections and global arrays are used to verify device information, determine the available port pairs between target devices, and establish long communication through the basic network port to obtain other port information, ensuring the stability and flexibility of the connection.

Benefits of technology

It realizes flexible port connection between multiple devices, improves practicality and stability between devices, and avoids connection failures caused by firmware influence.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115514798B_ABST
    Figure CN115514798B_ABST
Patent Text Reader

Abstract

The present invention provides a multi-device multi-port connection method, and the method includes: a first target device and a second target device receive device information through a long connection and verify the device information according to a global array set by a user; after verifying the device information, the first target device and the second target device receive port information through the long connection; the first target device and the second target device connect at least one pair of target port pairs according to the port information, the device information, and the global array; after connecting the target port pairs, the first target device and the second target device connect the remaining target devices according to the global array and the long connection. A unified port selection mechanism is adopted to determine the port pairs that can be used to establish a connection between two devices, so as to realize the establishment of connections between multiple devices with multiple types of ports, and improve the practicability and flexibility.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of device connection, and particularly to a multi-device multi-port connection method, system, electronic device, and storage medium. Background Art

[0002] In the current era of big data informatization, the application of the Linux system is very extensive and deeply loved by users. One of the most commonly used applications is that it can be used to build WWW servers, database servers, load balancing servers, mail servers, DNS servers, proxy servers, routers, etc. Since the Linux kernel supports IPalias, PPP, and IPtunneling, these functions can be used to establish virtual hosts, virtual services, VPNs (Virtual Private Networks), etc. Moreover, it has penetrated into various industries such as telecommunications, finance, government, education, banking, and petroleum, making its application scenarios extremely complex and variable. To meet the requirements of various scenarios, higher requirements are imposed on the connection and communication between some devices. Summary of the Invention

[0003] Based on this, in view of the above technical problems, it is necessary to provide a multi-device multi-port connection method, system, electronic device, and storage medium that can establish connections between multiple devices with multiple ports through a unified port selection mechanism.

[0004] In a first aspect, a multi-device multi-port connection method is provided, and the method includes:

[0005] A first target device and a second target device receive device information through a long connection and verify the device information according to a global array set by a user;

[0006] After verifying the device information, the first target device and the second target device receive port information through the long connection;

[0007] The first target device and the second target device connect at least one pair of target port pairs according to the port information, the device information, and the global array;

[0008] After connecting the target port pairs, the first target device and the second target device connect the remaining target devices according to the global array and the long connection.

[0009] In one embodiment, before the first target device and the second target device receive device information through a long connection and verify the device information according to a global array set by a user, it includes:

[0010] The user configures a first network interface of the first target device and a second network interface of the second target device, and generates the long connection according to the first network interface and the second network interface.

[0011] In one embodiment, the first target device and the second target device receive device information through a long connection and verify the device information according to a global array set by the user, including:

[0012] The first target device receives second device information sent by the second target device;

[0013] Determine whether a first global array of the first target device contains the second device information;

[0014] If so, send first device information and first port information to the second target device;

[0015] If not, save the second device information to the first global array and send the first device information and first port information to the second target device;

[0016] The second target device receives the first device information and the first port information;

[0017] Determine whether a second global array of the second target device contains the first device information;

[0018] If so, send second port information to the first target device;

[0019] If not, save the first device information to the second global array and send the second port information to the first target device.

[0020] In one embodiment, the first target device and the second target device connect at least one pair of target port pairs according to the port information, the device information, and the global array, including:

[0021] The first target device and the second target device determine whether the first target device and the second target device are of the same type according to the first device information and the second device information;

[0022] If so, connect multiple pairs of the target port pairs according to the port information and the global array;

[0023] If not, connect one pair of the target port pairs according to the port information and the global array.

[0024] In one embodiment, the first target device and the second target device connecting at least one pair of target port pairs according to the port information, the device information, and the global array further includes:

[0025] Determine whether the target port pair contains a target port that has been connected to the port of another device according to the port information;

[0026] If so, determine whether the global array of the target device where the target port is located contains the device connected to the target port.

[0027] In one embodiment, the determining whether the global array of the target device where the target port is located contains the device connected to the target port includes:

[0028] If so, reuse the target port and connect the target port pair according to the port information and the global array.

[0029] If not, cancel the connection between the target port and other device ports and connect the target port pair according to the port information and the global array.

[0030] In one embodiment, after the connection of the target port pair is completed, the first target device and the second target device connect the remaining target devices according to the global array and the long connection, including:

[0031] Determine whether the global array contains the remaining unconnected target devices.

[0032] When the first global array contains the remaining unconnected target devices, the first target device starts to connect the remaining target devices according to the long connection.

[0033] When the second global array contains the remaining unconnected target devices, the second target device starts to connect the remaining target devices according to the long connection.

[0034] On the other hand, provided is a multi-device multi-port connection system, which includes:

[0035] A first target device and a second target device, configured to receive device information through a long connection and verify the device information according to a globally set array by a user.

[0036] The first target device and the second target device are configured to receive port information through the long connection after the verification of the device information is completed.

[0037] The first target device and the second target device are configured to connect at least one pair of target port pairs according to the port information, the device information, and the global array.

[0038] The first target device and the second target device are configured to connect the remaining target devices according to the global array and the long connection after the connection of the target port pair is completed.

[0039] In one embodiment, before the first target device and the second target device receive device information through a long connection and verify the device information according to a global array set by the user, the following steps are included:

[0040] The user configures the first network interface of the first target device and the second network interface of the second target device, and generates the long connection according to the first network interface and the second network interface.

[0041] In one embodiment, when the first target device and the second target device receive device information through a long connection and verify the device information according to a global array set by the user, the following steps are included:

[0042] The first target device receives the second device information sent by the second target device;

[0043] Determine whether the first global array of the first target device contains the second device information;

[0044] If so, send the first device information and the first port information to the second target device;

[0045] If not, save the second device information to the first global array and send the first device information and the first port information to the second target device;

[0046] The second target device receives the first device information and the first port information;

[0047] Determine whether the second global array of the second target device contains the first device information;

[0048] If so, send the second port information to the first target device;

[0049] If not, save the first device information to the second global array and send the second port information to the first target device.

[0050] In one embodiment, when the first target device and the second target device connect at least one pair of target port pairs according to the port information, the device information, and the global array, the following steps are included:

[0051] The first target device and the second target device determine whether the first target device and the second target device are of the same type according to the first device information and the second device information;

[0052] If so, connect multiple pairs of the target port pairs according to the port information and the global array;

[0053] If not, connect one pair of the target port pairs according to the port information and the global array.

[0054] In one embodiment, the connection of at least one pair of target port pairs by the first target device and the second target device according to the port information, the device information, and the global array further includes:

[0055] Determine whether the target port pair contains a target port that is already connected to the port of another device according to the port information;

[0056] If so, determine whether the global array of the target device where the target port is located contains the device connected to the target port.

[0057] In one embodiment, the determination by the first target device and the second target device of whether the global array of the target device where the target port is located contains the device connected to the target port includes:

[0058] If so, reuse the target port and connect the target port pair according to the port information and the global array;

[0059] If not, cancel the connection between the target port and the port of another device and connect the target port pair according to the port information and the global array.

[0060] In one embodiment, after the connection of the target port pair is completed, the connection of the remaining target devices by the first target device and the second target device according to the global array and the long connection includes:

[0061] Determine whether the global array contains the remaining target devices that are not connected;

[0062] When the first global array contains the remaining target devices that are not connected, the first target device starts to connect the remaining target devices according to the long connection;

[0063] When the second global array contains the remaining target devices that are not connected, the second target device starts to connect the remaining target devices according to the long connection.

[0064] In another aspect, an electronic device is provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented:

[0065] The first target device and the second target device receive device information through a long connection and verify the device information according to the global array set by the user;

[0066] After the verification of the device information is completed, the first target device and the second target device receive port information through the long connection;

[0067] The first target device and the second target device connect at least one pair of target port pairs according to the port information, the device information, and the global array;

[0068] After the connection of the target port pairs is completed, the first target device and the second target device connect the remaining target devices according to the global array and the long connection.

[0069] In one embodiment, when the processor executes the computer program, the following steps are implemented:

[0070] Before the first target device and the second target device receive device information through a long connection and verify the device information according to the globally set global array, it includes:

[0071] The user configures the first network interface of the first target device and the second network interface of the second target device, and generates the long connection according to the first network interface and the second network interface.

[0072] In one embodiment, when the processor executes the computer program, the following steps are implemented:

[0073] The first target device and the second target device receive device information through a long connection and verify the device information according to the globally set global array, including:

[0074] The first target device receives the second device information sent by the second target device;

[0075] Determine whether the first global array of the first target device contains the second device information;

[0076] If so, send the first device information and the first port information to the second target device;

[0077] If not, save the second device information to the first global array and send the first device information and the first port information to the second target device;

[0078] The second target device receives the first device information and the first port information;

[0079] Determine whether the second global array of the second target device contains the first device information;

[0080] If so, send the second port information to the first target device;

[0081] If not, save the first device information to the second global array and send the second port information to the first target device.

[0082] In one embodiment, when the processor executes the computer program, the following steps are implemented:

[0083] The connection of at least one pair of target port pairs by the first target device and the second target device according to the port information, the device information, and the global array includes:

[0084] The first target device and the second target device determine whether the first target device and the second target device are of the same type according to the first device information and the second device information;

[0085] If so, multiple pairs of the target port pairs are connected according to the port information and the global array;

[0086] If not, one pair of the target port pairs is connected according to the port information and the global array.

[0087] In one embodiment, when the processor executes the computer program, the following steps are implemented:

[0088] The connection of at least one pair of target port pairs by the first target device and the second target device according to the port information, the device information, and the global array further includes:

[0089] Determine whether the target port pair includes a target port that has been connected to the port of another device according to the port information;

[0090] If so, determine whether the global array of the target device where the target port is located includes the device connected to the target port.

[0091] In one embodiment, when the processor executes the computer program, the following steps are implemented:

[0092] The determination of whether the global array of the target device where the target port is located includes the device connected to the target port includes:

[0093] If so, reuse the target port and connect the target port pair according to the port information and the global array;

[0094] If not, cancel the connection between the target port and the port of another device and connect the target port pair according to the port information and the global array.

[0095] In one embodiment, when the processor executes the computer program, the following steps are implemented:

[0096] After the connection of the target port pair is completed, the connection of the remaining target devices by the first target device and the second target device according to the global array and the long connection includes:

[0097] Determine whether the remaining target devices that are not connected are included in the global array;

[0098] When the remaining target devices that are not connected are included in the first global array, the first target device starts to connect the remaining target devices according to the long connection;

[0099] When the remaining target devices that are not connected are included in the second global array, the second target device starts to connect the remaining target devices according to the long connection.

[0100] In another aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:

[0101] The first target device and the second target device receive device information through a long connection and verify the device information according to the global array set by the user;

[0102] After verifying the device information, the first target device and the second target device receive port information through the long connection;

[0103] The first target device and the second target device connect at least one pair of target port pairs according to the port information, the device information, and the global array;

[0104] After connecting the target port pairs, the first target device and the second target device connect the remaining target devices according to the global array and the long connection.

[0105] In one embodiment, when the computer program is executed by a processor, the following steps are implemented:

[0106] Before the first target device and the second target device receive device information through a long connection and verify the device information according to the global array set by the user, it includes:

[0107] The user configures the first network interface of the first target device and the second network interface of the second target device, and generates the long connection according to the first network interface and the second network interface.

[0108] In one embodiment, when the computer program is executed by a processor, the following steps are implemented:

[0109] The first target device and the second target device receive device information through a long connection and verify the device information according to the global array set by the user, which includes:

[0110] The first target device receives the second device information sent by the second target device;

[0111] Determine whether the first global array of the first target device contains the second device information;

[0112] If so, send the first device information and the first port information to the second target device;

[0113] If not, save the second device information to the first global array and send the first device information and the first port information to the second target device;

[0114] The second target device receives the first device information and the first port information;

[0115] Determine whether the second global array of the second target device contains the first device information;

[0116] If so, send the second port information to the first target device;

[0117] If not, save the first device information to the second global array and send the second port information to the first target device.

[0118] In one embodiment, when the computer program is executed by a processor, the following steps are implemented:

[0119] The connection of at least one pair of target port pairs by the first target device and the second target device according to the port information, the device information, and the global array includes:

[0120] The first target device and the second target device determine whether the first target device and the second target device are of the same type according to the first device information and the second device information;

[0121] If so, connect multiple pairs of the target port pairs according to the port information and the global array;

[0122] If not, connect one pair of the target port pairs according to the port information and the global array.

[0123] In one embodiment, when the computer program is executed by a processor, the following steps are implemented:

[0124] The connection of at least one pair of target port pairs by the first target device and the second target device according to the port information, the device information, and the global array further includes:

[0125] Determine whether the target port pair contains a target port that has been connected to the port of another device according to the port information;

[0126] If so, determine whether the global array of the target device where the target port is located contains the device connected to the target port.

[0127] In one embodiment, when the computer program is executed by a processor, the following steps are implemented:

[0128] Determining whether the global array of the target device where the target port is located contains the device connected to the target port includes:

[0129] If so, reuse the target port and connect the target port pair according to the port information and the global array;

[0130] If not, cancel the connection between the target port and other device ports and connect the target port pair according to the port information and the global array.

[0131] In one embodiment, when the computer program is executed by a processor, the following steps are implemented:

[0132] After the connection of the target port pair ends, the first target device and the second target device connect the remaining target devices according to the global array and the long connection, including:

[0133] Determine whether the global array contains the remaining target devices that are not connected;

[0134] When the first global array contains the remaining target devices that are not connected, the first target device starts to connect the remaining target devices according to the long connection;

[0135] When the second global array contains the remaining target devices that are not connected, the second target device starts to connect the remaining target devices according to the long connection.

[0136] Wherein, the first target device and the second target device receive device information through a long connection and verify the device information according to the global array set by the user; after the verification of the device information ends, the first target device and the second target device receive port information through the long connection; the first target device and the second target device connect at least one pair of target port pairs according to the port information, the device information and the global array; after the connection of the target port pair ends, the first target device and the second target device connect the remaining target devices according to the global array and the long connection. By a unified port selection mechanism, the port pairs available for establishing a connection between two devices are determined to achieve the establishment of connections between multiple devices with multiple types of ports, improving the practicability and flexibility; using the basic network interface to establish a long communication to obtain all other port information, avoiding the inability to connect due to the influence of firmware on various devices. BRIEF DESCRIPTION OF THE DRAWINGS

[0137] Figure 1 It is a topological schematic diagram of a multi-device multi-port connection method;

[0138] Figure 2 Schematic diagram of steps of a multi-device multi-port connection method;

[0139] Figure 3 Flow diagram of a multi-device multi-port connection method;

[0140] Figure 4 Internal structure diagram of a computer device in an embodiment of the present invention. Detailed implementation manners

[0141] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application.

[0142] The multi-device multi-port connection method provided by the present application can be applied to a topological diagram of a multi-device multi-port connection method as shown in Figure 1 Among them, there can be multiple devices. Before each device is connected, the user will set a global variable array. The number of array members is the maximum number of devices that can be supported, and each member corresponds to a connected device to save its device information.

[0143] In one embodiment, as shown in Figure 2 the present invention provides a multi-device multi-port connection method, and the method includes:

[0144] S201. A first target device and a second target device receive device information through a long connection and verify the device information according to a global array set by the user;

[0145] S202. After verifying the device information, the first target device and the second target device receive port information through the long connection;

[0146] S203. The first target device and the second target device connect at least one pair of target port pairs according to the port information, the device information and the global array;

[0147] S204. After connecting the target port pairs, the first target device and the second target device connect the remaining target devices according to the global array and the long connection.

[0148] Specifically, a unified port selection mechanism is used to determine the port pairs that can be used to establish a connection between two devices, so as to realize the establishment of connections between multiple devices and multiple types of ports, improving the practicability and flexibility; a basic network interface is used to establish a long communication to obtain all other port information, avoiding the inability to connect due to the influence of firmware on various devices.

[0149] In one embodiment, before the first target device and the second target device receive device information through a long connection and verify the device information according to a global array set by the user, it includes:

[0150] The user configures the first network interface of the first target device and the second network interface of the second target device, and generates the long connection according to the first network interface and the second network interface.

[0151] Specifically, the user configures the basic network interface IP of the first target device, such as eth0, and configures the basic network interface IP of the second target device, such as eth1, and establishes a socket connection (long connection) between the first target device and the second target device through eth0 and eth1.

[0152] In one embodiment, the first target device and the second target device receive device information through a long connection and verify the device information according to a global array set by the user, including:

[0153] The first target device receives the second device information sent by the second target device;

[0154] Determine whether the first global array of the first target device contains the second device information;

[0155] If so, send the first device information and the first port information to the second target device;

[0156] If not, save the second device information to the first global array and send the first device information and the first port information to the second target device;

[0157] The second target device receives the first device information and the first port information;

[0158] Determine whether the second global array of the second target device contains the first device information;

[0159] If so, send the second port information to the first target device;

[0160] If not, save the first device information to the second global array and send the second port information to the first target device.

[0161] Specifically, such as Figure 3As shown, the first target device designates the second target device to initiate a discovery_req (discovery request) to it via the established long connection, which can be initiated by an instruction or other means. The second target device sends a data packet containing the second device information to the first target device according to this instruction, which should include the message type and local device information, such as: device type, model, name, IP and MAC of the basic network port, etc. The first target device retrieves the members in the global array to determine whether there is second target device information saved due to past connections. If there is, it sends a corresponding data packet containing the first device information and also selects this member to reconnect with the second target device. If not, it selects an unused member in the global array, saves the data packet sent by the designated second target device and sends a data packet containing the first device information to the second target device. After receiving the information, the second target device also first checks in its local global array to see if there is a matching information. If not, it selects an unused member in the global array, saves the received first device information and sends a data packet containing the second device information and an RSCN (rescan) instruction to the first target device again; After receiving it, since the first target device can find the received information in its local global array, it then rescans the port information to prevent information updates and responds to the second target device, and then sends a data packet containing the first device information and the first port information and an RSCN instruction. This data packet should include the message type and all port information of the first target device itself (including port information of FC cards, port information of network cards, etc.). After receiving it, since the second target device can find the received information in its local global array, it rescans the local port information and sends a data packet containing the second port information to the first target device.

[0162] In one embodiment, the connection of at least one pair of target port pairs by the first target device and the second target device according to the port information, the device information and the global array includes:

[0163] The first target device and the second target device determine whether the first target device and the second target device are the same type of device according to the first device information and the second device information;

[0164] If so, connect multiple pairs of the target port pairs according to the port information and the global array;

[0165] If not, connect one pair of the target port pairs according to the port information and the global array.

[0166] Specifically, the first target device and the second target device can be used for one of a WWW server, a database server, a load balancing server, a mail server, a DNS server, a proxy server, a router, etc. For example, when both the first target device and the second target device are used for a proxy server, multiple pairs of target port pairs are selected for connection at this time; when the first target device is used for a mail server and the second target device is used for a router, only one pair of target port pairs between them needs to be selected for connection. The connection between port pairs can be established using protocols such as iSCSI (Internet Small Computer System Interface), FC (Fibre Channel), RoCE (RDMA over Converged Ethernet).

[0167] In one embodiment, the first target device and the second target device connecting at least one pair of target port pairs according to the port information, the device information, and the global array further includes:

[0168] Determining whether the target port pair contains a target port that has been connected to the port of another device according to the port information;

[0169] If so, determining whether the global array of the target device where the target port is located contains the device connected to the target port.

[0170] Specifically, as described above, when the first target device used for a mail server and the second target device used for a router determine to perform a two-way connection of the local network cards, that is, the first target device and the second target device respectively connect to the network card ports in the first target device and the network card ports in the second target device. When the first target device is connected and it is determined that the local network card port has been connected to the network card port of another device such as a database server, it is necessary to determine whether the database server is included in its own global array at this time.

[0171] In one embodiment, determining whether the global array of the target device where the target port is located contains the device connected to the target port includes:

[0172] If so, reusing the target port and connecting the target port pair according to the port information and the global array;

[0173] If not, canceling the connection between the target port and the port of another device and connecting the target port pair according to the port information and the global array.

[0174] Specifically, as described above, if the database server is not included in the global array, that is, the connection to the database server is illegal. At this time, the connection to the database server is cancelled, and the two-way connection with the second target device is continued through the connected network card port. If it is included, it is determined that the network card port is in a one-to-many connection mode. At this time, the network card port is reused to perform a two-way connection with the second target device on the basis of ensuring the connection to the database server.

[0175] In one embodiment, after the connection of the target port pair ends, the first target device and the second target device connect the remaining target devices according to the global array and the long connection, including:

[0176] Determine whether the remaining unconnected target devices are included in the global array;

[0177] When the remaining unconnected target devices are included in the first global array, the first target device starts to connect the remaining target devices according to the long connection;

[0178] When the remaining unconnected target devices are included in the second global array, the second target device starts to connect the remaining target devices according to the long connection.

[0179] Specifically, after the connection between the first target device and the second target device ends, it is determined whether there are unconnected devices in the global array. If so, the remaining unconnected devices recorded in the global array are connected respectively. And after the connection, the target device monitors the connection status in real time. When a connection anomaly is found, a reconnection is initiated. After multiple connection failures, the connection is directly cancelled. The specific number of reconnections and the monitoring frequency are set according to the importance of the target device; when the port information of any one of the two devices at both ends changes, an RSCN notification is sent to the opposite end, so that the opposite end initiates a discovery_req process again, re-obtains the port information and connects to ensure the instant connectivity of the two target devices.

[0180] The solution of the present application has the following beneficial effects:

[0181] 1) Through a unified port selection mechanism, the port pair available for establishing a connection between two devices is determined to realize the establishment of connections with multiple devices using multiple ports, improving the practicability and flexibility;

[0182] 2) Use the basic network port to establish a long communication to obtain all other port information, avoiding the inability to connect due to the influence of firmware on various devices;

[0183] 3) By maintaining real-time communication and port information change notification means, the stability and reliability of the device connection are ensured.

[0184] It should be understood that althoughFigure 2 The steps in the flowchart are shown in sequence according to the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2 at least a part of the steps in Figure 2 may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed alternately or in rotation with at least a part of other steps or sub-steps or stages of other steps.

[0185] In one embodiment, a multi-device multi-port connection system is provided. The system includes:

[0186] A first target device and a second target device, configured to receive device information through a long connection and verify the device information according to a global array set by a user;

[0187] The first target device and the second target device are configured to receive port information through the long connection after the verification of the device information is completed;

[0188] The first target device and the second target device are configured to connect at least one pair of target port pairs according to the port information, the device information, and the global array;

[0189] The first target device and the second target device are configured to connect the remaining target devices according to the global array and the long connection after the connection of the target port pairs is completed.

[0190] In one of the embodiments, before the first target device and the second target device receive device information through a long connection and verify the device information according to a global array set by a user, it includes:

[0191] The user configures a first network interface of the first target device and a second network interface of the second target device, and generates the long connection according to the first network interface and the second network interface.

[0192] In one of the embodiments, the first target device and the second target device receive device information through a long connection and verify the device information according to a global array set by a user, including:

[0193] The first target device receives second device information sent by the second target device;

[0194] Determine whether a first global array of the first target device contains the second device information;

[0195] If so, send the first device information and the first port information to the second target device;

[0196] If not, save the second device information to the first global array and send the first device information and the first port information to the second target device;

[0197] The second target device receives the first device information and the first port information;

[0198] Determine whether the second global array of the second target device contains the first device information;

[0199] If so, send the second port information to the first target device;

[0200] If not, save the first device information to the second global array and send the second port information to the first target device.

[0201] In one embodiment, the first target device and the second target device connecting at least one pair of target port pairs according to the port information, the device information, and the global array includes:

[0202] The first target device and the second target device determine whether the first target device and the second target device are of the same type according to the first device information and the second device information;

[0203] If so, connect multiple pairs of the target port pairs according to the port information and the global array;

[0204] If not, connect one pair of the target port pairs according to the port information and the global array.

[0205] In one embodiment, the first target device and the second target device connecting at least one pair of target port pairs according to the port information, the device information, and the global array further includes:

[0206] Determine whether the target port pair contains a target port that has been connected to another device port according to the port information;

[0207] If so, determine whether the global array of the target device where the target port is located contains the device connected to the target port.

[0208] In one embodiment, the first target device and the second target device determining whether the global array of the target device where the target port is located contains the device connected to the target port includes:

[0209] If so, reuse the target port and connect the target port pair according to the port information and the global array;

[0210] Otherwise, cancel the connection between the target port and other device ports and connect the target port pair according to the port information and the global array.

[0211] In one embodiment, after connecting the target port pair, the first target device and the second target device connect the remaining target devices according to the global array and the long connection, including:

[0212] Determine whether the global array contains the remaining target devices that have not been connected;

[0213] When the first global array contains the remaining target devices that have not been connected, the first target device starts to connect the remaining target devices according to the long connection;

[0214] When the second global array contains the remaining target devices that have not been connected, the second target device starts to connect the remaining target devices according to the long connection.

[0215] For the specific limitations of the multi-device multi-port connection system, reference can be made to the limitations of the multi-device multi-port connection method in the above text, which will not be elaborated here. Each module in the above multi-device multi-port connection system can be implemented in whole or in part by software, hardware, and their combination. The above-mentioned modules can be embedded in the processor of the computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to the above-mentioned modules.

[0216] In one embodiment, an electronic device is provided. The electronic device can be a terminal, and its internal structure diagram can be as Figure 4 shown. The electronic device includes a processor, a memory, a network interface, a display screen, and an input device connected through a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it realizes the alarm information processing method. The display screen of the electronic device can be a liquid crystal display screen or an electronic ink display screen. The input device of the electronic device can be a touch layer covered on the display screen, or a button, a trackball, or a touchpad set on the housing of the electronic device, or an external keyboard, a touchpad, or a mouse, etc.

[0217] Those skilled in the art can understand, Figure 4The structure shown is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the electronic device to which the solution of this application is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine some components, or have a different component layout.

[0218] In one embodiment, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented:

[0219] The first target device and the second target device receive device information through a long connection and verify the device information according to a global array set by the user;

[0220] After verifying the device information, the first target device and the second target device receive port information through the long connection;

[0221] The first target device and the second target device connect at least one pair of target port pairs according to the port information, the device information, and the global array;

[0222] After connecting the target port pairs, the first target device and the second target device connect the remaining target devices according to the global array and the long connection.

[0223] In one of the embodiments, when the processor executes the computer program, the following steps are implemented:

[0224] Before the first target device and the second target device receive device information through a long connection and verify the device information according to a global array set by the user, it includes:

[0225] The user configures the first network interface of the first target device and the second network interface of the second target device, and generates the long connection according to the first network interface and the second network interface.

[0226] In one of the embodiments, when the processor executes the computer program, the following steps are implemented:

[0227] The first target device and the second target device receive device information through a long connection and verify the device information according to a global array set by the user, including:

[0228] The first target device receives the second device information sent by the second target device;

[0229] Determine whether the first global array of the first target device contains the second device information;

[0230] If so, send the first device information and the first port information to the second target device;

[0231] If not, save the second device information to the first global array and send the first device information and the first port information to the second target device;

[0232] The second target device receives the first device information and the first port information;

[0233] Determine whether the second global array of the second target device contains the first device information;

[0234] If so, send the second port information to the first target device;

[0235] If not, save the first device information to the second global array and send the second port information to the first target device.

[0236] In one embodiment, when the processor executes the computer program, the following steps are implemented:

[0237] The connection of at least one pair of target port pairs by the first target device and the second target device according to the port information, the device information, and the global array includes:

[0238] The first target device and the second target device determine whether the first target device and the second target device are of the same type according to the first device information and the second device information;

[0239] If so, connect multiple pairs of the target port pairs according to the port information and the global array;

[0240] If not, connect one pair of the target port pairs according to the port information and the global array.

[0241] In one embodiment, when the processor executes the computer program, the following steps are implemented:

[0242] The connection of at least one pair of target port pairs by the first target device and the second target device according to the port information, the device information, and the global array further includes:

[0243] Determine whether the target port pair contains a target port that has been connected to the port of another device according to the port information;

[0244] If so, determine whether the global array of the target device where the target port is located contains the device connected to the target port.

[0245] In one embodiment, when the processor executes the computer program, the following steps are implemented:

[0246] Determining whether the global array of the target device where the target port is located contains the device connected to the target port includes:

[0247] If so, reuse the target port and connect the target port pair according to the port information and the global array;

[0248] If not, cancel the connection between the target port and other device ports and connect the target port pair according to the port information and the global array.

[0249] In one embodiment, when the processor executes the computer program, the following steps are implemented:

[0250] After the connection of the target port pair ends, the first target device and the second target device connect the remaining target devices according to the global array and the long connection, including:

[0251] Determine whether the global array contains the remaining unconnected target devices;

[0252] When the first global array contains the remaining unconnected target devices, the first target device starts to connect the remaining target devices according to the long connection;

[0253] When the second global array contains the remaining unconnected target devices, the second target device starts to connect the remaining target devices according to the long connection.

[0254] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:

[0255] The first target device and the second target device receive device information through a long connection and verify the device information according to the global array set by the user;

[0256] After the verification of the device information ends, the first target device and the second target device receive port information through the long connection;

[0257] The first target device and the second target device connect at least one pair of target port pairs according to the port information, the device information, and the global array;

[0258] After the connection of the target port pair ends, the first target device and the second target device connect the remaining target devices according to the global array and the long connection.

[0259] In one embodiment, when the computer program is executed by a processor, the following steps are implemented:

[0260] Before the first target device and the second target device receive device information through a long connection and verify the device information according to a global array set by the user, the steps include:

[0261] The user configures the first network interface of the first target device and the second network interface of the second target device, and generates the long connection according to the first network interface and the second network interface.

[0262] In one embodiment, when the computer program is executed by a processor, the following steps are implemented:

[0263] When the first target device and the second target device receive device information through a long connection and verify the device information according to a global array set by the user, the steps include:

[0264] The first target device receives second device information sent by the second target device;

[0265] Determine whether the first global array of the first target device contains the second device information;

[0266] If so, send the first device information and the first port information to the second target device;

[0267] If not, save the second device information to the first global array and send the first device information and the first port information to the second target device;

[0268] The second target device receives the first device information and the first port information;

[0269] Determine whether the second global array of the second target device contains the first device information;

[0270] If so, send the second port information to the first target device;

[0271] If not, save the first device information to the second global array and send the second port information to the first target device.

[0272] In one embodiment, when the computer program is executed by a processor, the following steps are implemented:

[0273] When the first target device and the second target device connect at least one pair of target port pairs according to the port information, the device information, and the global array, the steps include:

[0274] The first target device and the second target device determine whether the first target device and the second target device are of the same type according to the first device information and the second device information;

[0275] If so, connect multiple pairs of the target port pairs according to the port information and the global array;

[0276] If not, connect one pair of the target port pairs according to the port information and the global array.

[0277] In one embodiment, when the computer program is executed by a processor, the following steps are implemented:

[0278] The connection of at least one pair of target port pairs by the first target device and the second target device according to the port information, the device information, and the global array further includes:

[0279] Determine whether the target port pair contains a target port that has been connected to the port of another device according to the port information;

[0280] If so, determine whether the global array of the target device where the target port is located contains the device connected to the target port.

[0281] In one embodiment, when the computer program is executed by a processor, the following steps are implemented:

[0282] The determination of whether the global array of the target device where the target port is located contains the device connected to the target port includes:

[0283] If so, reuse the target port and connect the target port pair according to the port information and the global array;

[0284] If not, cancel the connection between the target port and the port of another device and connect the target port pair according to the port information and the global array.

[0285] In one embodiment, when the computer program is executed by a processor, the following steps are implemented:

[0286] When the connection of the target port pair is completed, the connection of the remaining target devices by the first target device and the second target device according to the global array and the long connection includes:

[0287] Determine whether the global array contains the remaining unconnected target devices;

[0288] When the first global array contains the remaining unconnected target devices, the first target device starts to connect the remaining target devices according to the long connection;

[0289] When the second global array contains the remaining unconnected target devices, the second target device starts to connect the remaining target devices according to the long connection.

[0290] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the various embodiments provided in this application can include non-volatile and / or volatile memories. Non-volatile memories can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memories can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM), etc.

[0291] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this specification.

[0292] The above-described embodiments merely represent several implementation manners of this application. Their descriptions are relatively specific and detailed, but they should not be construed as limitations on the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of this application, several modifications and improvements can still be made, and these all belong to the protection scope of this application. Therefore, the protection scope of the patent of this application should be subject to the appended claims.

Claims

1. A multi-device multi-port connection method, the method comprising: The first target device and the second target device receive device information through a long connection and verify the device information according to a global array set by the user; After verifying the device information, the first target device and the second target device receive port information through the long connection; The first target device and the second target device connect at least one pair of target port pairs according to the port information, the device information, and the global array; After connecting the target port pairs, the first target device and the second target device connect the remaining target devices according to the global array and the long connection; After connecting the target port pairs, in response to detecting a target device with a change in port information among the first target device and the second target device, trigger the target device with the changed port information to send a rescan instruction to the other target device to achieve reconnection of the two target devices.

2. The method according to claim 1, wherein Before the first target device and the second target device receive device information through a long connection and verify the device information according to a global array set by the user, it includes: The user configures the first network interface of the first target device and the second network interface of the second target device, and generates the long connection according to the first network interface and the second network interface.

3. The method according to claim 1, characterized in that, The first target device and the second target device receive device information through a long connection and verify the device information according to a global array set by the user, including: The first target device receives the second device information sent by the second target device; Determine whether the first global array of the first target device contains the second device information; If so, send the first device information and the first port information to the second target device; If not, save the second device information to the first global array and send the first device information and the first port information to the second target device; The second target device receives the first device information and the first port information; Determine whether the second global array of the second target device contains the first device information; If so, send the second port information to the first target device; If not, save the first device information to the second global array and send the second port information to the first target device.

4. The method according to claim 3, characterized in that The first target device and the second target device connect at least one pair of target port pairs according to the port information, the device information, and the global array, including: The first target device and the second target device determine whether the first target device and the second target device are of the same type according to the first device information and the second device information; If so, connect multiple pairs of the target port pairs according to the port information and the global array; If not, connect one pair of the target port pairs according to the port information and the global array.

5. The method according to claim 4, wherein The first target device and the second target device connecting at least one pair of target port pairs according to the port information, the device information, and the global array further includes: Determine whether the target port pair contains a target port that has been connected to the port of another device according to the port information; If so, determine whether the global array of the target device where the target port is located contains the device connected to the target port.

6. The method according to claim 5, wherein The determining whether the global array of the target device where the target port is located contains the device connected to the target port includes: If so, reuse the target port and connect the target port pair according to the port information and the global array; If not, cancel the connection between the target port and other device ports and connect the target port pair according to the port information and the global array.

7. The method according to claim 3, wherein After connecting the target port pair, the first target device and the second target device connect the remaining target devices according to the global array and the long connection, including: Determine whether the global array contains the remaining unconnected target devices; When the first global array contains the remaining unconnected target devices, the first target device starts to connect the remaining target devices according to the long connection; When the second global array contains the remaining unconnected target devices, the second target device starts to connect the remaining target devices according to the long connection.

8. A multi-device multi-port connection system, the system includes: A first target device and a second target device, configured to receive device information through a long connection and verify the device information according to a globally set array by a user; After verifying the device information, the first target device and the second target device are configured to receive port information through the long connection; The first target device and the second target device are configured to connect at least one pair of target port pairs according to the port information, the device information, and the global array; After connecting the target port pair, the first target device and the second target device are configured to connect the remaining target devices according to the global array and the long connection; After connecting the target port pair, in response to detecting a target device with a changed port information among the first target device and the second target device, the target device with the changed port information triggers to send a rescan instruction to the other target device to achieve reconnection of the two target devices.

9. An electronic device, characterized in that, Including: One or more processors; And a memory associated with the one or more processors, the memory is configured to store program instructions, and when the program instructions are read and executed by the one or more processors, the method according to any one of claims 1 to 7 is executed.

10. A computer storage medium, characterized in that, A computer program is stored thereon, wherein when the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Method for supporting access to multiple power terminals, unit node and power Internet of Things

    CN112583941A