Data communication method, device, storage medium and computer device

By receiving and utilizing the mapping between network card physical addresses and names in computer devices, the problem of not being able to establish communication links using network card physical addresses in existing technologies is solved, enabling convenient communication link establishment and reducing the complexity and resource consumption of application layer modules.

CN122457576APending Publication Date: 2026-07-24XIAN QINGSONG PHOTOELECTRIC TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
XIAN QINGSONG PHOTOELECTRIC TECH CO LTD
Filing Date
2025-01-24
Publication Date
2026-07-24

Smart Images

  • Figure CN122457576A_ABST
    Figure CN122457576A_ABST
Patent Text Reader

Abstract

The application provides a data communication method and device, a storage medium and a computer device, and is applied to an electronic device including a plurality of communication ports. The method comprises the following steps: receiving a target network card physical address of a target communication device; the target communication device is a communication device to be established with a communication link among a plurality of communication devices connected with the plurality of communication ports; determining a target network card name corresponding to the target network card physical address according to a corresponding relationship between a network card physical address and a network card name; determining a target communication port corresponding to the target network card name from the plurality of communication ports according to a corresponding relationship between a network card name and a communication port; and establishing a communication link between the target communication device and the target communication port. The application can establish a communication link between the electronic device and the communication device through the network card physical address, and improves the convenience of establishing the communication link between the electronic device and the communication device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of data communication, specifically to a data communication method, apparatus, storage medium, and computer equipment. Background Technology

[0002] When a computer (PC) establishes a communication link with a communication device, the computer needs to obtain the network interface card (NIC) name of the communication device to establish the link. However, it cannot establish a communication link using the NIC's physical address (MAC address, Media Access Control Address). This means that even if a user knows the NIC's MAC address, they cannot establish a communication link using it, resulting in poor ease of establishing a communication link between the computer and the communication device. Summary of the Invention

[0003] The purpose of this application is to overcome the shortcomings and deficiencies in the prior art and provide a data communication method, device, storage medium and computer equipment, so that users can establish a communication link between electronic devices and communication devices through the physical address of the network card, thereby improving the convenience of establishing a communication link between electronic devices and communication devices.

[0004] A first aspect of this application provides a data communication method applied to an electronic device, the electronic device including a plurality of communication ports; the method includes:

[0005] Receive the physical address of the target network card of the target communication device; the target communication device is the communication device to be established among several communication devices connected to several communication ports;

[0006] Based on the correspondence between the physical address and the name of the network card, determine the name of the target network card corresponding to the physical address of the target network card;

[0007] Based on the correspondence between network interface card (NIC) names and communication ports, determine the target communication port corresponding to the target NIC name from among the plurality of communication ports;

[0008] A communication link is established with the target communication device through the target communication port.

[0009] Compared to related technologies, after receiving the physical address of the target network card of the target communication device, this application can determine the target network card name corresponding to the target network card physical address based on the correspondence between the network card physical address and the network card name. Then, based on the correspondence between the network card name and the communication port, the target communication port corresponding to the target network card name can be determined from several communication ports. A communication link can be established with the target communication device through the target communication port. This makes it convenient for users to establish a communication link between electronic devices and communication devices through the network card physical address, and improves the convenience of establishing a communication link between electronic devices and communication devices.

[0010] In one embodiment, the correspondence between the network interface card's physical address and its name is obtained through the following steps:

[0011] Obtain device information of the plurality of communication devices;

[0012] Extract the physical network interface card (NIC) address and NIC name from the aforementioned device information;

[0013] Based on the extracted physical network interface card (NIC) address and NIC name, the mapping relationship between the NIC physical address and NIC name is obtained.

[0014] Since the mapping between network interface card (NIC) physical addresses and NIC names needs to be constructed based on real-time NIC physical addresses and NIC names, and the device information of communication devices includes NIC physical addresses and NIC names, it is necessary to obtain the real-time NIC physical addresses and NIC names by acquiring the device information of several communication devices and then extracting the physical NIC addresses and NIC names from the device information. This allows for the construction of the mapping between NIC physical addresses and NIC names, and can accurately obtain the mapping between NIC physical addresses and NIC names for all device information.

[0015] In one embodiment, the step of obtaining the device information of the plurality of communication devices includes:

[0016] The system-level module of the electronic device is used to query the device information of several communication devices.

[0017] In this embodiment, the system layer module can obtain the device information of all communication devices connected to the electronic device through the packet capture function. Therefore, querying the device information from the system layer module can quickly and accurately obtain the device information of the communication devices.

[0018] In one embodiment, the step of querying device information of several communication devices from the system layer module of the electronic device includes:

[0019] Based on the preset update time cycle, the system layer module of the electronic device is used to query and obtain the device information of several communication devices.

[0020] In this embodiment, by using a preset update time period, device information of several communication devices can be periodically queried from the system layer module of the electronic device in terms of time dimension. This enhances the real-time performance of the physical network card address and network card name extracted from the device information, which is beneficial for obtaining a highly real-time correspondence between the network card physical address and the network card name. When the target network card physical address of the target communication device is received, the target network card name can be determined immediately based on the highly real-time correspondence between the network card physical address and the network card name, thereby improving the efficiency of determining the target network card name and thus improving the efficiency of establishing a communication link.

[0021] In one embodiment, the step of querying device information of several communication devices from the system layer module of the electronic device includes:

[0022] In response to receiving the target network card physical address of the target communication device, the system layer module of the electronic device is queried to obtain device information of several communication devices.

[0023] In this embodiment, the device information of several communication devices will not be queried from the system layer module of the electronic device before the target network card physical address of the target communication device is received. Therefore, the number of times the device information is queried from the system layer module of the electronic device is reduced, which can save the resources consumed in querying the device information.

[0024] In one embodiment, the correspondence between the network interface card (NIC) name and the communication port is obtained through the following steps:

[0025] The device information of the plurality of communication devices is obtained through each communication port;

[0026] Extract the network interface card (NIC) name from the aforementioned device information;

[0027] Based on the network card name extracted from the device information and the communication port corresponding to the device information, the correspondence between the network card name and the communication port is obtained.

[0028] In this embodiment, since the device information is obtained based on the communication port, the network card name extracted from the device information will have a corresponding relationship with the corresponding device information and the communication port. By acquiring the device information in real time, a real-time correspondence between the network card name and the communication port can be constructed, and the correspondence between the network card name and the communication port for all device information can be accurately obtained.

[0029] In one embodiment, the step of receiving the physical address of the target network interface card of the target communication device includes:

[0030] Receive the target network card physical address entered by the user in the device communication interface;

[0031] Alternatively, the device communication interface can be displayed, which includes the physical addresses of the network cards of each communication device connected to the communication port, and receives the target network card physical address selected by the user in the device communication interface.

[0032] In this embodiment, the process of obtaining the target network card physical address is simplified by inputting or selecting the target network card physical address through the device communication interface, which can conveniently and quickly receive the target network card physical address of the target communication device.

[0033] A second aspect of this application provides a data communication method applied to an electronic device, the electronic device including an application layer module and a system layer module; the method includes:

[0034] The application layer module receives the target network card physical address of the target communication device and sends the target network card physical address to the system layer module; the target communication device is one of several communication devices connected to several communication ports of the electronic device, and the communication device for which a communication link is to be established.

[0035] The system layer module determines the target network card name corresponding to the target network card physical address based on the correspondence between the network card physical address and the network card name; it determines the target communication port corresponding to the target network card name from the plurality of communication ports based on the correspondence between the network card name and the communication port; and it establishes a communication link with the target communication device through the target communication port.

[0036] The application layer module communicates and interacts with the target communication device through the communication link.

[0037] Compared to related technologies, this application, after receiving the physical address of the target network card of the target communication device, can determine the target network card name corresponding to the target network card physical address based on the correspondence between the network card physical address and the network card name. Then, based on the correspondence between the network card name and the communication port, it can determine the target communication port corresponding to the target network card name from a number of communication ports, so as to establish a communication link with the target communication device through the target communication port. This facilitates users in establishing a communication link between electronic devices and communication devices through the network card physical address, improving the convenience of establishing a communication link between electronic devices and communication devices. Moreover, for the data communication method provided in the second embodiment of this application, since the application layer module does not need to include a function module that calls the system layer module to obtain and display the network card name, it is also beneficial to reduce the software size of the application layer module.

[0038] A third aspect of this application provides a data communication device applied to an electronic device, the electronic device including a plurality of communication ports; the device includes:

[0039] The target network interface card (NIC) physical address acquisition module is used to receive the target NIC physical address of the target communication device; the target communication device is the communication device to be established among several communication devices connected to several communication ports;

[0040] The target network interface name acquisition module is used to determine the target network interface name corresponding to the target network interface physical address based on the correspondence between the network interface physical address and the network interface name.

[0041] The communication port acquisition module is used to determine the target communication port corresponding to the target network card name from the plurality of communication ports according to the correspondence between network card names and communication ports;

[0042] A communication link establishment module is used to establish a communication link with the target communication device through the target communication port.

[0043] A fourth aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the data communication method described above.

[0044] A fifth aspect of this application provides a computer device including a storage device, a processor, and a computer program stored in the storage device and executable by the processor, wherein the processor executes the computer program to implement the steps of the data communication method described above.

[0045] Compared to related technologies, after receiving the physical address of the target network card of the target communication device, this application can determine the target network card name corresponding to the target network card physical address based on the correspondence between the network card physical address and the network card name. Then, based on the correspondence between the network card name and the communication port, the target communication port corresponding to the target network card name can be determined from several communication ports. A communication link can be established with the target communication device through the target communication port. This makes it convenient for users to establish a communication link between electronic devices and communication devices through the network card physical address, and improves the convenience of establishing a communication link between electronic devices and communication devices.

[0046] To provide a clearer understanding of this application, the specific embodiments of this application will be described below in conjunction with the accompanying drawings. Attached Figure Description

[0047] Figure 1 This is a flowchart illustrating a data communication method according to an embodiment of this application.

[0048] Figure 2 This is a flowchart of steps S21-S23 of a data communication method according to an embodiment of this application.

[0049] Figure 3This is a flowchart of steps S301-S303 of a data communication method according to an embodiment of this application.

[0050] Figure 4 This is a flowchart of steps S211-S212 of a data communication method according to an embodiment of this application.

[0051] Figure 5 This is a flowchart illustrating the module steps of a data communication method according to an embodiment of this application.

[0052] Figure 6 This is a schematic diagram of the module connections of a data communication device according to an embodiment of this application. Detailed Implementation

[0053] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0054] It should be understood that the described embodiments are merely some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of the embodiments of this application.

[0055] In the following description, when referring to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. In the description of this application, it should be understood that the terms "first," "second," "third," etc., are used only to distinguish similar objects and are not necessarily used to describe a specific order or sequence, nor should they be construed as indicating or implying relative importance. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances. The singular forms "a," "the," and "the" used in this application and the appended claims are also intended to include the plural forms, unless the context clearly indicates otherwise. The word "if" as used herein can be interpreted as "when," "when," or "in response to determination."

[0056] Furthermore, in the description of this application, unless otherwise stated, "multiple" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.

[0057] In existing technologies, when a computer establishes a communication link with a communication device, the computer needs to obtain the network interface card (NIC) name of the communication device in order to establish the communication link. However, it is not possible to establish a communication link between the computer and the communication device using the NIC's physical address (MAC address). Therefore, even if a user knows the NIC's physical address, they cannot establish a communication link between the computer and the communication device using the NIC's physical address, resulting in poor convenience in establishing a communication link between the computer and the communication device.

[0058] The applicant discovered during practice that this problem arises because the network interface card (NIC) physical address can only identify the NIC, but cannot indicate the communication port connected to it. The NIC name, however, is the information the computer uses to identify the communication port connected to the NIC. Especially when establishing a communication link using WinPcap (Windows Packet Capture, a public network access system) or Npcap (Non-privileged Packet Capture), existing WinPcap and Npcap tools only support establishing a communication link with the communication device through the NIC name, not through the NIC physical address. Therefore, the application layer module needs to call WinPcap or Npcap to obtain the NIC name and then transmit it to the system layer module, allowing the system layer module to drive WinPcap or Npcap to establish a communication link based on the NIC name. In other words, the application layer module needs to have the functionality to call WinPcap or Npcap to obtain and display the NIC name, as well as the functionality to transmit the NIC name to WinPcap or Npcap, resulting in a large and redundant deficiency in the application layer module.

[0059] Therefore, the application layer module running on the computer needs to obtain and display the network card names of several communication devices connected to the computer through the computer's system layer module. Then, the application layer module sends the network card names of the communication links to be established to the system layer module, so that the system layer module can establish a communication link with the target communication device corresponding to the network card name. Only then can the application layer module communicate and interact with the target communication device through the communication link. This results in the application layer module needing to include a functional module that calls the system layer module to obtain and display the network card names, as well as a functional module that transmits the network card names to the system layer module, in order to establish a communication link with the target communication device through the system layer module. Therefore, the application layer module has a huge redundancy defect.

[0060] This application establishes a communication link between the network card and the target communication device based on the network card's physical address, making it easier for users to establish a communication link between electronic devices and communication devices through the network card's physical address, thus improving the convenience of establishing a communication link between electronic devices and communication devices.

[0061] The application scenarios of this application include electronic devices and multiple communication devices. The electronic devices are wiredly connected to the multiple communication devices. Before the electronic devices communicate with the target communication devices, the electronic devices need to determine the target communication devices to be communicated with and establish a communication link with the target communication devices so as to communicate with the target communication devices through the communication link.

[0062] Please see Figure 1 This is a flowchart of a data communication method according to an embodiment of this application. The data communication method is applied to an electronic device, which includes several communication ports; including:

[0063] Step S101: Receive the physical address of the target network card of the target communication device; the target communication device is the communication device to be established among several communication devices connected to several communication ports.

[0064] In this context, electronic devices can be computer devices with multiple communication ports, or multiple communication devices connected to multiple communication ports, all of which include network interface cards (NICs). The NIC's physical address is its MAC address (Media Access Control Address), a unique identifier burned into the NIC during manufacturing. A MAC address consists of 48 bits of binary data, typically represented as 6 hexadecimal digits. The target NIC's physical address is the NIC's physical address of the communication device to which the communication link is to be established.

[0065] Step S102: Determine the target network card name corresponding to the target network card physical address based on the correspondence between the network card physical address and the network card name.

[0066] The mapping between network interface card (NIC) physical addresses and NIC names can be obtained by extracting information from the device information of several communication devices. There is no specific order requirement between the steps of obtaining the mapping between NIC physical addresses and NIC names and step S101.

[0067] A network interface card (NIC) name is an information identifier used by a computer to identify the communication port to which a communication device is connected. The NIC name can be an information identifier assigned by the computer to the communication device based on the device information. The computer establishes a correspondence between the NIC name and the communication port to determine the communication port to which the communication device is connected.

[0068] Step S103: Based on the correspondence between network card names and communication ports, determine the target communication port corresponding to the target network card name from a number of communication ports.

[0069] The mapping between network interface card (NIC) names and communication ports can be obtained by extracting information from several communication devices. There is no specific order requirement between the steps of obtaining the mapping between NIC names and communication ports and step S101.

[0070] It should be noted that although step S103 is executed after step S102, the step of obtaining the correspondence between the network card name and the communication port can be obtained by the electronic device in advance. That is, even if the target network card physical address is not received, the device information of several communication devices can be obtained first to obtain the correspondence between the network card name and the communication port. Therefore, there is no limitation on the execution order between the step of obtaining the correspondence between the network card name and the communication port and the step of obtaining the correspondence between the network card physical address and the network card name. Optionally, the correspondence between the network card name and the communication port can be obtained before step S101, thereby improving the efficiency of establishing a communication link; or the device information of several communication devices can be obtained after step S101, and then the information can be extracted to obtain the correspondence between the network card physical address and the network card name, and the correspondence between the network card name and the communication port, respectively, reducing the number of information transmissions and saving the resources consumed by information transmission.

[0071] Step S104: Establish a communication link with the target communication device through the target communication port.

[0072] A communication link is established by performing several handshakes with the target communication device through the target communication port. A communication handshake is a process in computer networks where a communication link is established through a series of signal interactions. The handshake process confirms the data sending and receiving capabilities of both parties, ensuring the stability of the communication link.

[0073] The electronic device includes an application layer module and a system layer module. The application layer module is the software program installed and running on the electronic device, used to process the logic of the control algorithm. The system layer module supports the development and operation of the application layer module and is also responsible for managing various independent hardware components within the electronic device, enabling them to work in coordination. In this application, the application layer module only needs to transmit the target network interface card (NIC) physical address to the system layer module. The system layer module then determines the corresponding target NIC name and the target communication port based on the mapping between the NIC physical address and the NIC name, thereby establishing a communication link with the target communication device through the target communication port.

[0074] Compared to related technologies, this application, after receiving the physical address of the target network interface card (NIC) of the target communication device, can determine the target NIC name corresponding to the physical address based on the correspondence between the NIC physical address and the NIC name. Then, based on the correspondence between the NIC name and the communication port, it can determine the target communication port corresponding to the target NIC name from a number of communication ports, so as to establish a communication link with the target communication device through the target communication port. This facilitates users in establishing communication links between electronic devices and communication devices through the NIC physical address, improving the convenience of establishing communication links between electronic devices and communication devices. Moreover, the application layer module does not need to call WinPcap or NPcap to obtain and display the NIC name, reducing the complexity of the execution content of the application layer module and helping to reduce the software size of the application layer module.

[0075] In one embodiment, step S101 includes:

[0076] Receive the target network card physical address entered by the user in the device communication interface; or, display the device communication interface, which includes the network card physical addresses of each communication device connected to the communication port, and receive the target network card physical address selected by the user in the device communication interface.

[0077] The device communication interface is the front-end interface of the application layer module. The application layer module displays the device communication interface to obtain the target network card physical address input by the user, and then transmits the target network card physical address to the system layer module; or the application layer module displays the network card physical addresses of each communication device connected to the communication port through the device communication interface, so that the user can select the target network card physical address in the device communication interface, and then transmit the target network card physical address to the system layer module.

[0078] In this embodiment, the process of obtaining the target network card physical address is simplified by inputting or selecting the target network card physical address through the device communication interface, which can conveniently and quickly receive the target network card physical address of the target communication device.

[0079] Please see Figure 2 In one embodiment, the mapping between the network interface card's physical address and its name is obtained through the following steps:

[0080] Step S1021: Obtain device information for several communication devices.

[0081] The device information of the communication device can be obtained through the system layer module of the electronic device. The device information includes at least the information of the communication device's network card, such as the physical network card address, and the information of the communication port used by the system layer module to identify the connection of the device's network card, such as the network card name.

[0082] Step S1022: Extract the physical network card address and network card name from several device information.

[0083] Specifically, based on preset information extraction rules, the network interface card (NIC) address and NIC name corresponding to the same device information can be extracted from each device's information. The preset information extraction rules can extract information based on key characters or information locations within the device information to extract the NIC address and NIC name.

[0084] Step S1023: Based on the extracted physical network card address and network card name, obtain the correspondence between the physical address and the network card name.

[0085] This involves determining the existence and correspondence between the network card address and network card name of the same device information, and combining the network card addresses and network card names of all device information.

[0086] Since the mapping between network interface card (NIC) physical addresses and NIC names needs to be constructed based on real-time NIC physical addresses and NIC names, and the device information of communication devices includes NIC physical addresses and NIC names, it is necessary to obtain the real-time NIC physical addresses and NIC names by acquiring the device information of several communication devices and then extracting the physical NIC addresses and NIC names from the device information. This allows for the construction of the mapping between NIC physical addresses and NIC names, and can accurately obtain the mapping between NIC physical addresses and NIC names for all device information.

[0087] Please see Figure 3 In one embodiment, the correspondence between network interface card (NIC) names and communication ports is obtained through the following steps:

[0088] Step S1031: Obtain device information of several communication devices through each communication port.

[0089] Among them, the device information of the corresponding communication device can be read through each communication port.

[0090] Step S1032: Extract the network card name from several device information.

[0091] Step S1033: Based on the network card name extracted from the device information and the communication port corresponding to the device information, obtain the correspondence between the network card name and the communication port.

[0092] This involves determining whether there is a corresponding relationship between the network card name and communication port for the same device information, and combining the network card names and communication ports of all device information.

[0093] In this embodiment, since the device information is obtained based on the communication port, the network card name extracted from the device information will have a corresponding relationship with the corresponding device information and the communication port. By acquiring the device information in real time, a real-time correspondence between the network card name and the communication port can be constructed, and the correspondence between the network card name and the communication port for all device information can be accurately obtained.

[0094] Please see Figure 4 In one embodiment, step S1021: obtaining device information of several communication devices, includes:

[0095] Step S10211: Query the system layer module of the electronic device to obtain the device information of several communication devices.

[0096] The system-level module can use the `pcap_findalldevs` function to obtain device information for all communication devices connected to the communication ports of an electronic device. The `pcap_findalldevs` function is a packet capture function in the Libpcap library used to retrieve the communication interfaces of an electronic device and generate a list containing detailed information about the communication interfaces and their connected communication devices. libpcap is a network packet capture function package for Unix / Linux platforms.

[0097] In this embodiment, the system layer module can obtain the device information of all communication devices connected to the electronic device through the packet capture function. Therefore, by querying the device information from the system layer module, the device information of the communication device can be obtained quickly and accurately.

[0098] In one embodiment, step S10211 includes: querying and obtaining device information of several communication devices from the system layer module of the electronic device according to a preset update time period.

[0099] The update time period can be preset by the manufacturer or the user. The update time period is used to trigger the sending of device information search instructions by means of cumulative time or countdown. For example, when the real-time cumulative time reaches the update time period, the device information search instruction is sent to several communication devices and the real-time cumulative time is reset to 0; when the real-time countdown time decreases to 0, the device information search instruction is sent to several communication devices and the real-time cumulative time is reset to the preset update time period.

[0100] In this embodiment, by using a preset update time period, device information of several communication devices can be periodically queried from the system layer module of the electronic device in terms of time dimension. This enhances the real-time performance of the physical network card address and network card name extracted from the device information, which is beneficial for obtaining a highly real-time correspondence between the network card physical address and the network card name. When the target network card physical address of the target communication device is received, the target network card name can be determined immediately based on the highly real-time correspondence between the network card physical address and the network card name, thereby improving the efficiency of determining the target network card name and thus improving the efficiency of establishing a communication link.

[0101] In another embodiment, step S10211 includes: in response to receiving the physical address of the target network card of the target communication device, querying the system layer module of the electronic device to obtain device information of several communication devices.

[0102] Therefore, in this embodiment, step S10211 will not be executed before step S101 is executed, that is, the device information of several communication devices will not be obtained from the system layer module of the electronic device. This can reduce the number of times the device information is obtained from the system layer module of the electronic device and save the resources consumed in obtaining the device information.

[0103] Please see Figure 5 The second embodiment of this application provides a data communication method applied to an electronic device, the electronic device including an application layer module and a system layer module; the method includes:

[0104] Step S10: The application layer module receives the target network card physical address of the target communication device and sends the target network card physical address to the system layer module; the target communication device is the communication device to be established among several communication devices connected to several communication ports of the electronic device.

[0105] Step S20: The system layer module determines the target network card name corresponding to the target network card physical address based on the correspondence between the network card physical address and the network card name; it determines the target communication port corresponding to the target network card name from several communication ports based on the correspondence between the network card name and the communication port; and it establishes a communication link with the target communication device through the target communication port.

[0106] Step S30: The application layer module communicates and interacts with the target communication device through the communication link.

[0107] It should be noted that the data communication method provided in the second embodiment of this application belongs to the same concept as the data communication method in the first embodiment of this application, and its implementation process is detailed in the method embodiments, which will not be repeated here. Moreover, for the data communication method provided in the second embodiment of this application, since the application layer module does not need to include calling the system layer module to obtain and display the network card name, it is beneficial to reduce the software size of the application layer module and reduce the complexity of the execution content of the application layer module.

[0108] Please see Figure 6 The third embodiment of this application provides a data communication device 200, applied to an electronic device, the electronic device including a plurality of communication ports; the device includes:

[0109] The target network interface physical address acquisition module 201 is used to receive the target network interface physical address of the target communication device; the target communication device is the communication device to be established among several communication devices connected to several communication ports.

[0110] The target network interface name acquisition module 202 is used to determine the target network interface name corresponding to the target network interface physical address based on the correspondence between the network interface physical address and the network interface name.

[0111] The communication port acquisition module 203 is used to determine the target communication port corresponding to the target network card name from a number of communication ports based on the correspondence between the network card name and the communication port.

[0112] The communication link establishment module 204 is used to establish a communication link with the target communication device through the target communication port.

[0113] It should be noted that the data communication device 200 provided in the third embodiment of this application is only illustrated by the above-described division of functional modules when executing the data communication method. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the data communication device 200 provided in the third embodiment of this application and the data communication method of the first embodiment of this application belong to the same concept, and its implementation process is detailed in the method embodiment, which will not be repeated here.

[0114] The fourth embodiment of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the data communication method described above.

[0115] The fifth embodiment of this application provides a computer device, including a storage device, a processor, and a computer program stored in the storage device and executable by the processor, wherein the processor executes the computer program to implement the steps of the data communication method described above.

[0116] The device embodiments described above are merely illustrative. The components described as separate parts may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this application according to actual needs. Those skilled in the art can understand and implement this without any inventive effort.

[0117] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0118] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 The computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function selected in one or more boxes.

[0119] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function selected in one or more boxes.

[0120] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0121] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0122] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0123] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0124] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A data communication method, characterized in that, Applied to an electronic device, the electronic device including a plurality of communication ports; the method includes: Receive the physical address of the target network card of the target communication device; the target communication device is the communication device to be established among several communication devices connected to several communication ports; Based on the correspondence between the physical address and the name of the network card, determine the name of the target network card corresponding to the physical address of the target network card; Based on the correspondence between network interface card (NIC) names and communication ports, determine the target communication port corresponding to the target NIC name from among the plurality of communication ports; A communication link is established with the target communication device through the target communication port.

2. The data communication method according to claim 1, characterized in that, The mapping between the network card's physical address and the network card name is obtained through the following steps: Obtain device information of the plurality of communication devices; Extract the physical network interface card (NIC) address and NIC name from the aforementioned device information; Based on the extracted physical network interface card (NIC) address and NIC name, the mapping relationship between the NIC physical address and NIC name is obtained.

3. The data communication method according to claim 2, characterized in that, The step of obtaining the device information of the plurality of communication devices includes: The system layer module of the electronic device is used to query the device information of several communication devices.

4. The data communication method according to claim 3, characterized in that, The step of querying the system layer module of the electronic device to obtain device information of several communication devices includes: According to a preset update time period, the device information of several communication devices is obtained by querying the system layer module of the electronic device.

5. The data communication method according to claim 3, characterized in that, The step of querying the system layer module of the electronic device to obtain device information of several communication devices includes: In response to receiving the target network card physical address of the target communication device, the system layer module of the electronic device is queried to obtain device information of several of the communication devices.

6. The data communication method according to claim 1, characterized in that, The correspondence between the network interface card (NIC) name and the communication port is obtained through the following steps: The device information of the plurality of communication devices is obtained through each communication port; Extract the network interface card (NIC) name from the aforementioned device information; Based on the network card name extracted from the device information and the communication port corresponding to the device information, the correspondence between the network card name and the communication port is obtained.

7. The data communication method according to any one of claims 1 to 6, characterized in that, The step of receiving the physical address of the target network card of the target communication device includes: Receive the target network card physical address entered by the user in the device communication interface; Alternatively, the device communication interface can be displayed, which includes the physical addresses of the network cards of each communication device connected to the communication port, and can receive the target network card physical address selected by the user in the device communication interface.

8. A data communication method, characterized in that, Applied to an electronic device, the electronic device including an application layer module and a system layer module; the method includes: The application layer module receives the target network card physical address of the target communication device and sends the target network card physical address to the system layer module; the target communication device is one of several communication devices connected to several communication ports of the electronic device, and the communication device for which a communication link is to be established. The system layer module determines the target network card name corresponding to the target network card physical address based on the correspondence between the network card physical address and the network card name; it determines the target communication port corresponding to the target network card name from the plurality of communication ports based on the correspondence between the network card name and the communication port; and it establishes a communication link with the target communication device through the target communication port. The application layer module communicates and interacts with the target communication device through the communication link.

9. A data communication device, characterized in that, Applied to an electronic device, the electronic device including a plurality of communication ports; the device includes: The target network interface card (NIC) physical address acquisition module is used to receive the target NIC physical address of the target communication device; the target communication device is the communication device to be established among several communication devices connected to several communication ports; The target network interface name acquisition module is used to determine the target network interface name corresponding to the target network interface physical address based on the correspondence between the network interface physical address and the network interface name. The communication port acquisition module is used to determine the target communication port corresponding to the target network card name from the plurality of communication ports according to the correspondence between network card names and communication ports; A communication link establishment module is used to establish a communication link with the target communication device through the target communication port.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, it implements the steps of the data communication method as described in any one of claims 1 to 8.

11. An electronic device, characterized in that: It includes a storage device, a processor, and a computer program stored in the storage device and executable by the processor, wherein the processor executes the computer program to implement the steps of the data communication method as described in any one of claims 1 to 8.