An addressing communication method and device, electronic equipment and storage medium

By broadcasting private layer and link layer encapsulated addressing request packets within the local area network, the addressing efficiency and accuracy issues under the TCP/IP communication mode are solved, the target service instance can be quickly and accurately located, and the network delay is reduced.

CN120075134BActive Publication Date: 2025-10-21DIGITAL GUANGDONG NETWORK CONSTR CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510282136.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-11
Publication Date
2025-10-21
Estimated Expiration
2045-03-11

AI Technical Summary

Technical Problem

In the cloud-based microservice governance system, the TCP/IP-based addressing communication method is time-consuming and inaccurate. The dynamic changes in the IP address and port number of the service instance lead to positioning anomalies.

Method used

Adopting the encapsulation mechanism of private layer header and link layer header, the private layer header is generated through the client identifier, service identifier and universal instance identifier, and combined with the original addressing request data packet, the addressing request data packet is broadcasted in the local area network, and the target service instance is determined according to the feedback time of the service instance.

Benefits of technology

It improves addressing efficiency and accuracy, reduces TCP communication connection time, avoids service instance positioning anomalies caused by time differences, and enhances communication efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120075134B_ABST
    Figure CN120075134B_ABST
Patent Text Reader

Abstract

Embodiments of the application disclose a method and device for addressing communication, electronic equipment and storage medium, and relate to the technical field of communication. The method comprises: obtaining a client identifier of a client and a service identifier of a target service; generating a first private layer packet header based on the client identifier, the service identifier and a general instance identifier, and encapsulating the first private layer packet header and an original addressing request data packet to obtain a first private layer data packet; generating a first link layer packet header based on a physical address of the client and a preset broadcast address, and encapsulating the first link layer packet header and the first private layer data packet to obtain a target addressing request data packet; broadcasting the target addressing request data packet in a preset local area network, so that at least one service instance feeds back an addressing response data packet of the target addressing request data packet; and determining a target service instance for communication with the client from the at least one service instance according to feedback time of the at least one service instance, thereby improving addressing efficiency and addressing accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of communication technology, and in particular to an addressing communication method, device, electronic device, and storage medium. Background Art

[0002] Addressed communication refers to the process in which, in order to accurately transmit data to the target node in a network environment, the source node needs to determine the location information of the target node through specific mechanisms and methods, and then establish a communication connection and realize data transmission.

[0003] Currently, in cloud-based microservice governance systems, when hosts within the same local area network communicate, the Transmission Control Protocol / Internet Protocol (TCP / IP) addressing communication method is usually adopted. That is, the registration center feeds back the IP address and corresponding port number of the host where the corresponding service instance is located to the client based on the client's addressing request data packet.

[0004] However, the TCP / IP-based addressing communication method takes a long time to establish a TCP communication connection. In addition, the IP address and port number of the service instance change dynamically. The response information fed back by the registration center may cause abnormal service instance positioning due to time difference, resulting in low addressing efficiency and accuracy. Summary of the Invention

[0005] The embodiments of the present application provide an addressing communication method, device, electronic device and storage medium, which implement addressing communication functions to solve the problems of low addressing efficiency and accuracy in the addressing communication methods in the prior art.

[0006] In a first aspect, an embodiment of the present application provides an addressing communication method, which is applied to a client, where the client is located in a preset local area network, and at least one service instance of a target service exists in the preset local area network. The method includes:

[0007] Get the client ID of the client and the service ID of the target service;

[0008] Generate a first private layer packet header based on the client identifier, the service identifier, and the universal instance identifier, and encapsulate the first private layer packet header and the original addressing request data packet to obtain a first private layer data packet;

[0009] Generate a first link layer packet header based on the client's physical address and the preset broadcast address, and encapsulate the first link layer packet header and the first private layer data packet to obtain a target addressing request data packet;

[0010] Broadcasting a target addressing request data packet in a preset local area network so that at least one service instance feeds back an addressing response data packet of the target addressing request data packet;

[0011] A target service instance for communicating with the client is determined from the at least one service instance according to a feedback time of the at least one service instance.

[0012] In the technical solution of the embodiment of the present application, the client identifier of the client and the service identifier of the target service can be obtained; a first private layer header is generated based on the client identifier, the service identifier and the universal instance identifier, and the first private layer header and the original addressing request data packet are encapsulated to obtain a first private layer data packet; a first link layer header is generated based on the physical address of the client and the preset broadcast address, and the first link layer header and the first private layer data packet are encapsulated to obtain a target addressing request data packet; the target addressing request data packet is broadcast in the preset local area network so that at least one service instance feeds back an addressing response data packet of the target addressing request data packet; according to the feedback time of at least one service instance, the target service instance communicating with the client is determined from at least one service instance, thereby realizing the addressing communication function. In the above technical solution, a private layer header is generated using the client identifier, service identifier, and universal instance identifier, and the private layer is encapsulated in combination with the original addressing request data packet. Then, data link layer encapsulation is performed and the target addressing request data packet is broadcast within a preset local area network. This allows sending an addressing request to all service instances of the target service, thereby improving addressing efficiency. Furthermore, based on the feedback time of the addressing response data packet fed back by the service instance, the target service instance with the best performance is determined from at least one service instance, thereby achieving addressing of the target service instance and improving addressing accuracy. Furthermore, since the service identifier and instance identifier are fixed, after addressing the target service instance, the target service instance is located using the service identifier and the instance identifier of the target service instance. This eliminates the problem of service instance location anomalies due to changes in the instance identifier, effectively avoiding the problem of service instance location anomalies due to time differences, and further improving addressing accuracy. Furthermore, the client and the target service instance only need a single request and response process to establish communication, reducing the connection time of TCP communication, thereby reducing network latency and improving communication efficiency.

[0013] In a second aspect, an embodiment of the present application provides an addressable communication device, which is applied to a client, the client being located in a preset local area network, and at least one service instance of a target service existing in the preset local area network. The device includes:

[0014] An acquisition module, used to obtain the client ID of the client and the service ID of the target service;

[0015] A first encapsulation module is configured to generate a first private layer packet header based on the client identifier, the service identifier, and the universal instance identifier, and to encapsulate the first private layer packet header and the original addressing request data packet to obtain a first private layer data packet;

[0016] A second encapsulation module is used to generate a first link layer packet header based on the physical address of the client and the preset broadcast address, and encapsulate the first link layer packet header and the first private layer data packet to obtain a target addressing request data packet;

[0017] A sending module, configured to broadcast a target addressing request data packet in a preset local area network, so that at least one service instance feeds back an addressing response data packet of the target addressing request data packet;

[0018] The determination module is configured to determine a target service instance for communicating with the client from at least one service instance according to a feedback time of the at least one service instance.

[0019] In a third aspect, an embodiment of the present application provides an electronic device, the electronic device comprising:

[0020] at least one processor; and a memory communicatively coupled to the at least one processor;

[0021] The memory stores a computer program that can be executed by at least one processor, and the computer program is executed by at least one processor so that the at least one processor can execute the addressing communication method of any embodiment of the present application.

[0022] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the addressing communication method of any embodiment of the present application.

[0023] The description of the second, third and fourth aspects in this application can refer to the detailed description of the first aspect; and the beneficial effects described in the second, third and fourth aspects can refer to the analysis of the beneficial effects of the first aspect, which will not be repeated here.

[0024] In this application, the name of the aforementioned addressable communication device does not limit the device or functional module itself. In actual implementation, these devices or functional modules may appear with other names. As long as the functions of each device or functional module are similar to those of this application, they fall within the scope of the claims of this application and their equivalents.

[0025] These and other aspects of the present application will become more readily apparent from the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0027] Figure 1 This is a flow chart of the addressing communication method provided by an embodiment of the present application;

[0028] Figure 2 This is an example diagram of the message format of the private communication protocol provided in an embodiment of the present application;

[0029] Figure 3 This is an example diagram of the message format of the Ethernet communication protocol provided in an embodiment of the present application;

[0030] Figure 4 This is a structural diagram of an addressing communication device provided in an embodiment of the present application;

[0031] Figure 5 It is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0032] To make the purpose, technical solutions, and advantages of the embodiments of the present application more clear, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.

[0033] It should be noted that the terms "first," "second," "target," and "original" in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including," "having," and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or apparatus comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or apparatus.

[0034] Figure 1This is a flow chart of the addressing communication method provided by an embodiment of the present application. This embodiment can be applied to scenarios where addressing communication needs to be performed between hosts in the same local area network. The addressing communication method provided by this embodiment can be executed by the addressing communication device provided by an embodiment of the present application, and the device can be implemented by software and / or hardware. In a specific embodiment, the addressing communication device can be integrated into an electronic device, and the electronic device can be a client, for example, the electronic device is a computer, etc. The execution subject of this method can be a client (i.e., an electronic device), see Figure 1 The addressing communication method of this embodiment includes but is not limited to the following steps:

[0035] S110: Obtain the client identifier of the client and the service identifier of the target service.

[0036] The client is located in a preset local area network, and at least one service instance of the target service exists in the preset local area network. The client identifier is a unique identifier of the client, and can be represented by text, letters, or numbers.

[0037] The target service is a specific network service that the client expects to access and interact with. It is implemented based on the network protocol and the corresponding software program, and can provide specific functions for the client or meet certain business needs. The service identifier is a pre-defined identifier and is the unique mark of the target service. For example, the service identifier can be expressed in the form of text, letters or numbers.

[0038] A service instance is a specific running instance of a target service, and is the deployment and running presentation of a target service in a specific network environment. At least one service instance of a target service can be deployed on the same host or on different hosts. The embodiment of this application is explained using the example of deploying service instances on different hosts. Each service instance has independent process space, memory area and other resources, and can independently process client requests or execute corresponding business logic.

[0039] Specifically, when the client needs to address the service instance corresponding to the target service in the preset local area network, it can obtain its own identifier, obtain the client identifier, and obtain the service identifier of the target service from the preset service list, where the preset service list is a list pre-stored in the client, including the service identifier of each service.

[0040] It should be noted that if the client does not require authorization verification, the client identifier can be generated by the authentication system and returned to the client; if the client requires authorization verification, the client identifier can be generated by the authorization verification system and returned to the client.

[0041] S120 : Generate a first private layer packet header based on the client identifier, the service identifier, and the universal instance identifier, and encapsulate the first private layer packet header and the original addressing request data packet to obtain a first private layer data packet.

[0042] The instance identifier is a predefined identifier that uniquely identifies a service instance. For example, the instance identifier can be represented by text, letters, or numbers. The universal instance identifier is a pre-set instance identifier used to identify all service instances. For example, the universal instance identifier can be 0.

[0043] The first private layer header is header information obtained by performing private layer encapsulation on the client identifier, the service identifier, and the universal instance identifier.

[0044] The original addressing request data packet is a data packet generated by the client and is used to carry a specific addressing request; optionally, the original addressing request data packet can be a data packet obtained by the client after being encapsulated by the application layer, including an application layer header and a data body, wherein the data body is used to carry a specific addressing request; the application layer is the network protocol layer in the standard network protocol stack; the standard network protocol stack may include the application layer, transport layer, network layer, data link layer and physical layer.

[0045] The first private layer data packet is a data packet obtained by encapsulating the first private layer packet header and the original addressing request data packet.

[0046] Specifically, after obtaining the client identifier and service identifier, addressing request data can be generated, and it can be determined whether the addressing request data involves the interaction of application layer protocols. If the addressing request data involves the interaction of application layer protocols, the addressing request data is encapsulated at the application layer, that is, the application layer header information, such as the protocol version number and uniform resource locator, etc., is determined, and these header information is encapsulated at the application layer to obtain the application layer header, and then the application layer header is added to the front of the addressing request data to obtain the original addressing request data packet; if the addressing request data does not involve the interaction of application layer protocols, it indicates that the addressing request data does not need to be encapsulated at the application layer, and the addressing request data can be directly used as the original addressing request data packet.

[0047] Then, the private layer can be encapsulated, that is, the first private layer header can be generated based on the client identifier, service identifier and universal instance identifier. For example, the client identifier, service identifier and universal instance identifier can be encapsulated according to the header format of the private communication protocol to obtain the first private layer header; then the first private layer header and the original addressing request data packet can be encapsulated. For example, the first private layer header and the original addressing request data packet can be encapsulated according to the message format of the private communication protocol to obtain the first private layer data packet.

[0048] Optionally, the private communication protocol is a custom communication protocol; the private layer is a network protocol layer corresponding to the private communication protocol, located above the data link layer and below the application layer; Figure 2 FIG. 1 is an example diagram of a message format of a private communication protocol provided in an embodiment of the present application. Figure 2 The message format of the private communication protocol in the protocol includes a header, a data body and a checksum. The header includes a client identifier, a service identifier, an instance identifier, a type and other header fields. When the initiator of the data packet is a client, the source address in the header is the client identifier, and the destination address in the header is the service identifier and the instance identifier. When the initiator of the data packet is a service instance, the source address in the header is the service identifier and the instance identifier, and the destination address in the header is the client identifier. The type is the data packet type (such as request and response, etc.), the data body is the data packet encapsulated by the application layer, and the checksum is used to verify the header and data body to ensure the integrity and accuracy of the data during transmission. It should be noted that the checksum can be generated using algorithms such as binary complement summation or cyclic redundancy check, which is the same as the checksum generation method in the prior art and will not be repeated here.

[0049] By using the client identifier to represent the request end address, it can be dynamically bound to the client's identity ticket, providing network layer and transport layer frame identification means for service instance request authentication, and at the same time providing an underlying communication protection mechanism for the security of the service instance; by using the service identifier and instance identifier to represent the service response end address, the service and the corresponding service instance can be located, thereby providing direct positioning capabilities for service operation status monitoring and service performance monitoring.

[0050] It should be noted that in the prior art, by parsing the data packets of the transport layer and the network layer, only the IP address and port number can be located, but the specific service instance cannot be determined by the IP address and port number. It is necessary to install a plug-in on the host corresponding to the IP address to collect the communication data of the service instance to determine the communication status and working status of the service instance, thereby realizing service operation status monitoring and service performance monitoring. In addition, since the IP address and port number are dynamically changing, there may be problems with service positioning anomalies caused by time differences in the communication data collected for monitoring. In particular, the shearing during service anomalies causes omissions or errors in the collection and analysis of operation and maintenance data. However, in the embodiment of the present application, the service identifier and instance identifier obtained by parsing the data packet of the private layer can directly locate the service and the specific service instance, and then the communication data of the service instance, that is, the data body in the data packet, can be directly obtained from the data packet to realize service operation status monitoring and service performance monitoring. There is no need to install a plug-in on the server side to monitor the status of the service instance, which can be decoupled from the service instance and can avoid the problem of service positioning anomalies caused by time differences, thereby improving monitoring efficiency and accuracy.

[0051] Furthermore, a first private layer header is generated based on the client identifier, the service identifier, and the universal instance identifier, and the first private layer header and the original addressing request data packet are encapsulated to obtain a first private layer data packet, including Sa1-Sa2:

[0052] Sa1. Use the client identifier as the source address of the private layer, use the service identifier and the universal instance identifier as the destination address of the private layer, and generate a first private layer header.

[0053] Specifically, the client identifier can be used as the source address of the private layer, and the service identifier and the general instance identifier can be used as the destination address of the private layer. The private layer header can be encapsulated to obtain the first private layer header. As a result, all service instances of the target service in the preset local area network can receive data packets whose instance identifier is the general instance identifier; for example, it is known that the client identifier is a, the service identifier of the target service is service1, and the general instance identifier is 0, then the source address of the first private layer header is a, and the destination address is service1-0.

[0054] Sa2. Add the first private layer header to the original addressing request data packet to obtain the first private layer data packet.

[0055] In an embodiment of the present application, by using the client identifier as the source address of the private layer and the service identifier and the general instance identifier as the destination address of the private layer, a first private layer data packet can be sent to all service instances of the target service within a preset local area network, so that all service instances of the target service can receive the client's addressing request, thereby improving the determination efficiency and accuracy of the first private layer data packet, providing an accurate data basis for the subsequent generation of the target addressing request data packet, thereby improving the addressing efficiency and accuracy.

[0056] S130: Generate a first link layer header based on the client's physical address and the preset broadcast address, and encapsulate the first link layer header and the first private layer data packet to obtain a target addressing request data packet.

[0057] The preset broadcast address is a pre-set broadcast address used to send data to all hosts in a preset local area network; illustratively, the preset broadcast address may be 00-00-00-00-00-00.

[0058] The first link layer packet header is header information obtained by encapsulating the client's physical address and the preset broadcast address. The target addressing request data packet is a data packet obtained by encapsulating the first link layer packet header and the first private layer data packet at the data link layer.

[0059] Specifically, after obtaining the first private layer data packet, data link layer encapsulation can be performed, that is, a first link layer header can be generated based on the client's physical address and the preset broadcast address. For example, the client's physical address and the preset broadcast address can be encapsulated according to the header format of the Ethernet communication protocol to obtain the first link layer header; then the first link layer header and the first private layer data packet can be encapsulated. For example, the first link layer header and the first private layer data packet can be encapsulated according to the message format of the Ethernet communication protocol to obtain a target addressing request data packet.

[0060] Optional, such as Figure 3 FIG. 1 is an example diagram of the message format of the Ethernet communication protocol provided in an embodiment of the present application. Figure 3 The message format of the Ethernet communication protocol in the protocol includes a preamble, a frame start code, a header, a data body, and a frame check. The header includes the source address, the destination address, and the frame type. The source address is the physical address of the initiator, the destination address is the physical address of the receiver, and the data body is the data packet encapsulated by the private layer. The preamble is used to help the initiator synchronize the clock at the physical layer. The frame start code is used to indicate the starting position of the Ethernet frame. The frame check is used to check the header and data body to ensure the integrity and accuracy of the data during transmission.

[0061] Furthermore, the client's physical address is used as the source address of the data link layer, and the preset broadcast address is used as the destination address of the data link layer. A first link layer header is generated, and the first link layer header is appended to the first private layer data packet to obtain a target addressing request data packet. By using the preset broadcast address as the destination address of the data link layer, the target addressing request data packet can be sent to all hosts within the preset local area network. This allows all hosts with service instances of the target service to receive the client's addressing request, thereby improving addressing efficiency and accuracy.

[0062] Optionally, the frame type corresponding to the private communication protocol can be pre-set as a preset frame type, whereby the content of the frame type field in the first link layer packet header is the preset frame type; by defining the preset frame type, the data packet corresponding to the private communication protocol can be directly identified through the content of the frame type field of the data link layer, and then the communication data of the service instance can be further collected based on the data packet corresponding to the private communication protocol, thereby improving the efficiency of service operation status monitoring and service performance monitoring.

[0063] S140: Broadcast the target addressing request data packet in the preset local area network, so that at least one service instance feeds back an addressing response data packet of the target addressing request data packet.

[0064] The addressed response packet is a response packet generated by a service instance in response to a target addressed request packet. Each service instance corresponds to one addressed response packet, meaning all service instances of the target service can generate addressed response packets. It should be noted that if a service instance experiences an exception, it will not generate an addressed response packet.

[0065] Optionally, the source address of the private layer in the addressed response data packet includes the service identifier and the instance identifier of the corresponding service instance, the destination address of the private layer in the addressed response data packet is the client identifier, the source address of the data link layer in the addressed response data packet is the physical address of the host where the corresponding service instance is located, and the destination address of the data link layer in the addressed response data packet is the physical address of the client.

[0066] Specifically, after obtaining the target addressing request data packet, the target addressing request data packet can be sent through the physical layer, that is, the target addressing request data packet is sent through the physical medium in the preset local area network (such as a network cable or radio electromagnetic waves), so as to broadcast the target addressing request data packet in the preset local area network; then, all hosts in the preset local area network can receive the target addressing request data packet, so that all service instances of the target service in the preset local area network receive the client's addressing request.

[0067] The host where the service instance of the target service is located can receive data packets. At this time, the data packets include target addressing request data packets sent by the client and data packets sent by other hosts. Then, the received data packets are filtered based on the Berkeley Packet Filter (BPF), that is, the data packets are parsed. If the destination address of the private layer in the data packet includes the service identifier and the universal instance identifier of the target service, the data packet is determined to be a target addressing request data packet sent by the client; otherwise, the data packet is determined to be a data packet sent by other hosts.

[0068] After receiving the target addressing request data packet, the host where the service instance of the target service is located can obtain the client's physical address, client identifier and addressing request data obtained by parsing the target addressing request data packet, and generate addressing response data for the addressing request data. Secondly, the addressing response data is encapsulated at the application layer to obtain the original addressing response data packet. Then, the service identifier of the target service and the instance identifier of the service instance are used as the source address of the private layer, and the client identifier is used as the destination address of the private layer to generate a response private layer header, and the response private layer header is added to the original addressing response data packet to obtain a response private layer data packet. Then, the physical address of the host is used as the source address of the data link layer, the physical address of the client is used as the destination address of the data link layer, and the preset frame type is used as the frame type of the data link layer to generate a response link layer header, and the response link layer header is added to the response private layer data packet to obtain an addressing response data packet. After that, the addressing response data packet is sent to the client through the physical layer.

[0069] S150: Determine a target service instance for communicating with the client from the at least one service instance according to the feedback time of the at least one service instance.

[0070] The feedback time is used to characterize the feedback performance of the service instance. For example, the feedback time can be the time it takes for the client to receive the addressed response data packet, or the time it takes for the host where the service instance is located to send the addressed response data packet.

[0071] The target service instance is the service instance with the best performance among the at least one service instance.

[0072] Specifically, an addressed response data packet fed back by at least one service instance can be received, and the feedback time of at least one service instance can be determined. In one implementation, the packet reception time of each addressed response data packet can be recorded, and then the packet reception time can be determined as the feedback time corresponding to the addressed response data packet, i.e., the feedback time of the corresponding service instance. In another implementation, the host where the service instance is located can carry the packet sending time when sending the addressed response data packet. Thus, after receiving the addressed response data packet fed back by at least one service instance, the client can determine the packet sending time as the feedback time corresponding to the addressed response data packet, i.e., the feedback time of the corresponding service instance.

[0073] Then, the target service instance communicating with the client can be determined from at least one service instance based on the feedback time and the addressing response data packet. For example, in one implementation method, the feedback times are sorted from small to large to obtain a sorting result, and any one feedback time is selected from the first three of the sorting results. Then, the instance identifier is extracted from the addressing response data packet corresponding to the feedback time, and the service instance corresponding to the instance identifier is determined as the target service instance.

[0074] In another implementation, a minimum feedback time can be determined from the feedback time of at least one service instance, where the minimum feedback time is the minimum of the feedback times of at least one service instance. An instance identifier is then extracted from the addressing response packet corresponding to the minimum feedback time, and the service instance corresponding to the instance identifier is determined as the target service instance. By determining the target service instance using the addressing response packet corresponding to the minimum feedback time, the service instance with the optimal performance can be accurately determined, thereby achieving addressing of the target service instance and improving addressing accuracy.

[0075] Optionally, before determining the minimum feedback time from the feedback time of at least one service instance, network data packets sent to the client can be monitored, and then the network data packets can be filtered based on preset filtering rules, and the addressed response data packets sent by at least one service instance can be identified from the network data packets, wherein the preset filtering rule is that the destination address of the private layer is the client identifier. Specifically, the network data packets can be filtered through BPF, and the addressed response data packets that meet the preset filtering rules can be identified from the network data packets. The preset filtering rules of BPF can accurately identify the addressed response data packets, so that the client only receives data packets with its own client identifier, providing an accurate data basis for the subsequent determination of the target service instance.

[0076] Optionally, after determining the target service instance for communication with the client from at least one service instance based on the feedback time of at least one service instance, the client can communicate with the target service instance, namely: (1) performing application layer encapsulation, specifically, generating business request data such as acquisition instructions (such as Structured Query Language (SQL) statements), and determining the header information of the application layer, such as the protocol version number and the uniform resource locator, etc., generating an application layer header, and then adding the application layer header to the business request data to obtain the original business request data packet, wherein the original business request data packet is intended to inform the target service instance of the operation to be performed or the resources to be fed back and other related information; (2) performing private layer encapsulation, specifically, using the client identifier as the source address of the private layer, using the service identifier and the instance identifier of the target service instance as the destination address of the private layer, generating a second private layer header, and adding the second private layer header to the private layer. (3) performing data link layer encapsulation, specifically, using the client's physical address as the source address of the data link layer, the physical address of the host where the target service instance is located as the destination address of the data link layer, and the preset frame type as the frame type of the data link layer to generate a second link layer header, and adding the second link layer header to the second private layer data packet to obtain a target business request data packet; (4) sending the target business request data packet to the host where the target service instance is located through the physical layer, so that the target service instance can feedback a business response data packet of the target business request data packet.

[0077] Then, the host where the target service instance is located can receive the target business request data packet sent by the client, and then parse the target business request data packet to obtain the business request data, and generate business response data corresponding to the business request data (such as the data corresponding to the SQL statement or the result of the operation execution), and then sequentially encapsulate the business response data at the application layer, private layer and data link layer to obtain a business response data packet, and send the business response data packet to the client; wherein, the source address of the private layer in the business response data packet includes the service identifier and the instance identifier of the target service instance, the destination address of the private layer is the client identifier, the source address of the data link layer is the physical address of the host where the target service instance is located, and the destination address of the data link layer is the physical address of the client. The target business request data packet can be obtained by filtering the data packet in the preset local area network through BPF, and the filtering rule is that the destination address of the private layer includes the service identifier and the instance identifier of the target service instance.

[0078] In an embodiment of the present application, by using the client identifier as the source address of the private layer and the service identifier and the instance identifier of the target service instance as the destination address of the private layer, the target service instance can be accurately located, thereby realizing communication between the client and the target service instance; and, the client can only receive data packets with its own client identifier through BPF, and the target service instance can only receive data packets with the service identifier of the target service and its own instance identifier through BPF, thereby realizing two-way duplex data communication between the client and the target service instance.

[0079] The technical solution of the embodiment of the present application can obtain the client identifier of the client and the service identifier of the target service; generate a first private layer header based on the client identifier, service identifier and universal instance identifier, and encapsulate the first private layer header and the original addressing request data packet to obtain a first private layer data packet; generate a first link layer header based on the physical address of the client and the preset broadcast address, and encapsulate the first link layer header and the first private layer data packet to obtain a target addressing request data packet; broadcast the target addressing request data packet in the preset local area network, so that at least one service instance feeds back an addressing response data packet of the target addressing request data packet; determine the target service instance communicating with the client from at least one service instance according to the feedback time of at least one service instance, thereby realizing the addressing communication function. In the above technical solution, a private layer header is generated using the client identifier, service identifier, and universal instance identifier, and the private layer is encapsulated in combination with the original addressing request data packet. Then, data link layer encapsulation is performed and the target addressing request data packet is broadcast within a preset local area network. This allows sending an addressing request to all service instances of the target service, thereby improving addressing efficiency. Furthermore, based on the feedback time of the addressing response data packet fed back by the service instance, the target service instance with the best performance is determined from at least one service instance, thereby achieving addressing of the target service instance and improving addressing accuracy. Furthermore, since the service identifier and instance identifier are fixed, after addressing the target service instance, the target service instance is located using the service identifier and the instance identifier of the target service instance. This eliminates the problem of service instance location anomalies due to changes in the instance identifier, effectively avoiding the problem of service instance location anomalies due to time differences, and further improving addressing accuracy. Furthermore, the client and the target service instance only need a single request and response process to establish communication, reducing the connection time of TCP communication, thereby reducing network latency and improving communication efficiency.

[0080] Figure 4 This is a schematic diagram of the structure of the addressing communication device provided in the embodiment of the present application, with reference to Figure 4 , the addressing communication device may include:

[0081] An acquisition module 410 is configured to acquire a client identifier of a client and a service identifier of a target service;

[0082] A first encapsulation module 420 is configured to generate a first private layer header based on the client identifier, the service identifier, and the universal instance identifier, and encapsulate the first private layer header and the original addressing request data packet to obtain a first private layer data packet;

[0083] The second encapsulation module 430 is configured to generate a first link layer header based on the physical address of the client and the preset broadcast address, and encapsulate the first link layer header and the first private layer data packet to obtain a target addressing request data packet;

[0084] The sending module 440 is configured to broadcast a target addressing request data packet in a preset local area network, so that at least one service instance feeds back an addressing response data packet of the target addressing request data packet;

[0085] The determination module 450 is configured to determine a target service instance for communicating with the client from the at least one service instance according to the feedback time of the at least one service instance.

[0086] In one embodiment, the first packaging module 420 is specifically configured to:

[0087] Using the client identifier as the source address of the private layer, and the service identifier and the universal instance identifier as the destination address of the private layer, to generate a first private layer header;

[0088] The first private layer packet header is added to the original addressing request packet to obtain the first private layer packet.

[0089] In one embodiment, the second packaging module 430 is specifically configured to:

[0090] The physical address of the client is used as the source address of the data link layer, and the preset broadcast address is used as the destination address of the data link layer to generate a first link layer packet header;

[0091] The first link layer packet header is added to the first private layer data packet to obtain a target addressing request data packet.

[0092] In one embodiment, the source address of the private layer in the addressed response data packet in the sending module 440 includes the service identifier and the instance identifier of the corresponding service instance, the destination address of the private layer in the addressed response data packet is the client identifier, the source address of the data link layer in the addressed response data packet is the physical address of the host where the corresponding service instance is located, and the destination address of the data link layer in the addressed response data packet is the physical address of the client.

[0093] In one embodiment, the determination module 450 is specifically configured to:

[0094] determining a minimum feedback time from feedback times of at least one service instance;

[0095] The instance identifier is extracted from the addressing response data packet corresponding to the minimum feedback time, and the service instance corresponding to the instance identifier is determined as the target service instance.

[0096] In one embodiment, the addressing communication device further includes a service communication module, which is specifically configured to:

[0097] After determining a target service instance for communicating with the client from the at least one service instance based on feedback time of the at least one service instance, using the client identifier as a source address of the private layer, using the service identifier and the instance identifier of the target service instance as a destination address of the private layer, generating a second private layer header, and appending the second private layer header to the front of the original service request data packet to obtain a second private layer data packet;

[0098] The client's physical address is used as the source address of the data link layer, and the physical address of the host where the target service instance is located is used as the destination address of the data link layer. A second link layer header is generated, and the second link layer header is added to the front of the second private layer data packet to obtain the target service request data packet;

[0099] Send a target service request data packet to the host where the target service instance is located, so that the target service instance feeds back a service response data packet in response to the target service request data packet.

[0100] In one embodiment, the addressing communication device further includes a filtering module, which is specifically configured to:

[0101] Before determining a minimum feedback time from feedback times of at least one service instance, monitoring network packets sent to the client;

[0102] The network data packets are filtered based on a preset filtering rule, and an addressed response data packet sent by at least one service instance is identified from the network data packets. The preset filtering rule is that the destination address of the private layer is the client identifier.

[0103] Those skilled in the art will clearly understand that for the sake of convenience and brevity of description, only the division of the above-mentioned functional modules is used as an example for illustration. In actual applications, the above-mentioned 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. The specific working process of the functional modules described above can refer to the corresponding process in the aforementioned method embodiment and will not be repeated here.

[0104] The addressing communication device provided in this embodiment can be applied to the addressing communication method provided in any of the above embodiments, and has corresponding functions and beneficial effects.

[0105] Figure 5 It is a structural diagram of an electronic device provided in an embodiment of the present application. Figure 5 A block diagram of an exemplary electronic device 11 suitable for implementing embodiments of the present application is shown. Figure 5 The electronic device 11 shown is only an example and should not bring any limitation to the functions and scope of use of this embodiment.

[0106] like Figure 5 As shown, electronic device 11 is implemented as a general-purpose computing electronic device. Components of electronic device 11 may include, but are not limited to, one or more processors or processing units 16, system memory 28, and a bus 18 connecting various system components (including system memory 28 and processing unit 16).

[0107] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures. Examples of these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.

[0108] The electronic device 11 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 11, including volatile and non-volatile media, removable and non-removable media.

[0109] The system memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The electronic device 11 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be configured to read and write non-removable, non-volatile magnetic media ( Figure 5 Not shown, often called a "hard drive"). Although Figure 5 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The system memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of various embodiments of the present application.

[0110] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may include an implementation of a network environment. Program modules 42 generally implement the functions and / or methods of the embodiments described herein.

[0111] The electronic device 11 may also communicate with one or more external devices 14 (e.g., a keyboard, a pointing device, a display 24, etc.), one or more devices that enable a user to interact with the electronic device 11, and / or any device that enables the electronic device 11 to communicate with one or more other computing devices (e.g., a network card, a modem, etc.). Such communication may be performed via an input / output (I / O) interface 22. Furthermore, the electronic device 11 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 20.

[0112] like Figure 5 As shown, the network adapter 20 communicates with other modules of the electronic device 11 via the bus 18. Figure 5 Not shown, other hardware and / or software modules may be used in conjunction with the electronic device 11, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0113] The processing unit 16 executes various functional applications and page displays by running programs stored in the system memory 28. For example, an addressing communication method provided in this embodiment is implemented and applied to a client. The client is located in a preset local area network. At least one service instance of a target service exists in the preset local area network. The method includes:

[0114] Get the client ID of the client and the service ID of the target service;

[0115] Generate a first private layer packet header based on the client identifier, the service identifier, and the universal instance identifier, and encapsulate the first private layer packet header and the original addressing request data packet to obtain a first private layer data packet;

[0116] Generate a first link layer packet header based on the client's physical address and the preset broadcast address, and encapsulate the first link layer packet header and the first private layer data packet to obtain a target addressing request data packet;

[0117] Broadcasting a target addressing request data packet in a preset local area network so that at least one service instance feeds back an addressing response data packet of the target addressing request data packet;

[0118] A target service instance for communicating with the client is determined from the at least one service instance according to a feedback time of the at least one service instance.

[0119] Of course, those skilled in the art will understand that the processor can also implement the technical solution of the addressing communication method provided in any embodiment of the present application.

[0120] An embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, an addressing communication method provided in an embodiment of the present application is implemented. The method is applied to a client, the client being located in a preset local area network, and at least one service instance of a target service existing in the preset local area network. The method includes:

[0121] Get the client ID of the client and the service ID of the target service;

[0122] Generate a first private layer packet header based on the client identifier, the service identifier, and the universal instance identifier, and encapsulate the first private layer packet header and the original addressing request data packet to obtain a first private layer data packet;

[0123] Generate a first link layer packet header based on the client's physical address and the preset broadcast address, and encapsulate the first link layer packet header and the first private layer data packet to obtain a target addressing request data packet;

[0124] Broadcasting a target addressing request data packet in a preset local area network so that at least one service instance feeds back an addressing response data packet of the target addressing request data packet;

[0125] A target service instance for communicating with the client is determined from the at least one service instance according to a feedback time of the at least one service instance.

[0126] The computer storage medium of this embodiment can adopt any combination of one or more computer-readable media. Computer-readable media can be computer-readable signal media or computer-readable storage media. Computer-readable storage media can be, for example, but not limited to: electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or components, or any combination thereof. More specific examples (non-exhaustive list) of computer-readable storage media include: electrical connections with one or more wires, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this document, computer-readable storage media can be any tangible medium containing or storing a program that can be used by an instruction execution system, device or device or used in combination with it.

[0127] A computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0128] Program code embodied on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0129] The computer program code for performing the operations of the present application can be written in one or more programming languages, or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0130] Those skilled in the art will appreciate that the modules or steps of the present application described above can be implemented using a general-purpose computing device. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Alternatively, they can be implemented using program code executable by a computer device, so that they can be stored in a storage device and executed by the computing device, or they can be fabricated into separate integrated circuit modules, or multiple modules or steps can be fabricated into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.

[0131] In addition, the acquisition, storage, use, and processing of data in the technical solution of this application comply with the relevant provisions of national laws and regulations.

[0132] Note that the above are only preferred embodiments of the present application and the technical principles employed. Those skilled in the art will understand that the present application is not limited to the specific embodiments herein, and that various obvious changes, readjustments, and substitutions can be made by those skilled in the art without departing from the scope of protection of the present application. Therefore, although the present application has been described in more detail through the above embodiments, the present application is not limited to the above embodiments and may include more other equivalent embodiments without departing from the inventive concept of the present application, and the scope of the present application is determined by the scope of the appended claims.

Claims

1. An addressing communication method, characterized in that: Applied to a client, the client being located in a preset local area network, and at least one service instance of a target service existing in the preset local area network, the method comprising: Obtaining a client identifier of the client and a service identifier of the target service; Generate a first private layer packet header based on the client identifier, the service identifier, and the universal instance identifier, and encapsulate the first private layer packet header and the original addressing request data packet to obtain a first private layer data packet; Generate a first link layer packet header based on the physical address of the client and the preset broadcast address, and encapsulate the first link layer packet header and the first private layer data packet to obtain a target addressing request data packet; Broadcasting the target addressing request data packet in the preset local area network, so that the at least one service instance feeds back an addressing response data packet of the target addressing request data packet; A target service instance for communicating with the client is determined from the at least one service instance according to the feedback time of the at least one service instance.

2. The addressing communication method according to claim 1, wherein: The generating a first private layer packet header based on the client identifier, the service identifier, and the universal instance identifier, and encapsulating the first private layer packet header and the original addressing request data packet to obtain a first private layer data packet includes: Using the client identifier as the source address of the private layer, and using the service identifier and the universal instance identifier as the destination address of the private layer, to generate the first private layer header; The first private layer packet header is added to the original addressing request packet to obtain the first private layer packet.

3. The addressing communication method according to claim 1, wherein: The generating a first link layer packet header based on the physical address of the client and the preset broadcast address, and encapsulating the first link layer packet header and the first private layer data packet to obtain a target addressing request data packet includes: Using the physical address of the client as the source address of the data link layer and the preset broadcast address as the destination address of the data link layer, generating the first link layer packet header; The first link layer header is added to the first private layer data packet to obtain the target addressing request data packet.

4. The addressing communication method according to claim 2, wherein: The source address of the private layer in the addressed response data packet includes the service identifier and the instance identifier of the corresponding service instance, the destination address of the private layer in the addressed response data packet is the client identifier, the source address of the data link layer in the addressed response data packet is the physical address of the host where the corresponding service instance is located, and the destination address of the data link layer in the addressed response data packet is the physical address of the client.

5. The addressing communication method according to claim 4, characterized in that: The determining, from the at least one service instance according to the feedback time of the at least one service instance, a target service instance for communicating with the client includes: determining a minimum feedback time from the feedback times of the at least one service instance; An instance identifier is extracted from the addressing response data packet corresponding to the minimum feedback time, and a service instance corresponding to the instance identifier is determined as the target service instance.

6. The addressing communication method according to claim 4, characterized in that: After determining a target service instance for communicating with the client from the at least one service instance according to the feedback time of the at least one service instance, the method further includes: Using the client identifier as the source address of the private layer, using the service identifier and the instance identifier of the target service instance as the destination address of the private layer, generating a second private layer header, and adding the second private layer header to the original service request data packet to obtain a second private layer data packet; Using the physical address of the client as the source address of the data link layer and the physical address of the host where the target service instance is located as the destination address of the data link layer, generating a second link layer packet header, and adding the second link layer packet header to the front of the second private layer data packet to obtain a target service request data packet; The target service request data packet is sent to the host where the target service instance is located, so that the target service instance feeds back a service response data packet of the target service request data packet.

7. The addressing communication method according to claim 5, characterized in that: Before determining the minimum feedback time from the feedback times of the at least one service instance, the method further includes: monitoring network data packets sent to the client; The network data packet is filtered based on a preset filtering rule, and the addressed response data packet sent by the at least one service instance is identified from the network data packet, wherein the preset filtering rule is that the destination address of the private layer is the client identifier.

8. An addressing communication device, characterized in that: Applied to a client, the client is located in a preset local area network, and at least one service instance of a target service exists in the preset local area network, the device includes: An acquisition module, configured to acquire a client identifier of the client and a service identifier of the target service; A first encapsulation module is configured to generate a first private layer packet header based on the client identifier, the service identifier, and the universal instance identifier, and to encapsulate the first private layer packet header and the original addressing request data packet to obtain a first private layer data packet; A second encapsulation module is configured to generate a first link layer packet header based on the physical address of the client and a preset broadcast address, and encapsulate the first link layer packet header and the first private layer data packet to obtain a target addressing request data packet; a sending module, configured to broadcast the target addressing request data packet in the preset local area network, so that the at least one service instance feeds back an addressing response data packet of the target addressing request data packet; A determination module is configured to determine, from the at least one service instance, a target service instance for communicating with the client based on a feedback time of the at least one service instance.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to perform the addressing communication method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the addressing communication method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Interne-of-Things equipment coding method and system based on blockchain, and storage medium

    CN112003926A

  • Data management method and device, electronic equipment and storage medium

    CN115834194A