Addressing communication method and device, electronic equipment and storage medium

By using the addressing communication method of private layer and link layer header encapsulation in the cloud-based microservice governance system, the problem of low addressing efficiency and accuracy is solved, efficient and accurate service instance positioning is achieved, and network delay is reduced.

CN120075134AActive Publication Date: 2025-05-30DIGITAL GUANGDONG NETWORK CONSTR CO LTD

Patent Information

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

AI Technical Summary

Technical Problem

The addressing communication method in the prior art has problems with low addressing efficiency and accuracy in the cloud-based microservice governance system, especially due to dynamic changes in the IP address and port number of the service instance, resulting in abnormal positioning.

Method used

By obtaining the client identity and the service identity of the target service on the client, generating a private layer packet header and encapsulating the original address request packet, generating a link layer packet header in combination with the physical address and preset broadcast address, broadcasting to obtain the feedback time of the service instance, thereby determining the target service instance with the best performance.

Benefits of technology

It improves addressing efficiency and accuracy, avoids positioning abnormalities caused by changes in service instance identification, and reduces the time-consuming and network delay of TCP communication connections.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120075134A_ABST
    Figure CN120075134A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses an addressing communication method and device, electronic equipment and a storage medium, and relates to the technical field of communication. The method comprises the following steps: acquiring 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 the general instance identifier, and packaging the first private layer packet header and the original addressing request data packet to obtain a first private layer data packet; generating a first link layer packet header based on the physical address of the client and a preset broadcast address, and packaging 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; according to the feedback time of the at least one service instance, the target service instance communicating with the client is determined from the at least one service instance, and the addressing efficiency and the addressing accuracy are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

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

[0003] Currently, in a cloudified microservice governance system, 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, based on the addressing request data packet of the client, the registration center feeds back the IP address of the host where the corresponding service instance is located and the corresponding port number to the client.

[0004] However, based on the TCP / IP addressing communication method, the time taken to establish a TCP communication connection is long, and moreover, the IP address and port number of the service instance are dynamically changing, and there may be a problem of abnormal service instance positioning due to time difference for the response information fed back by the registration center, resulting in low addressing efficiency and accuracy. Summary of the Invention

[0005] Embodiments of the present application provide an addressing communication method, apparatus, electronic device, and storage medium, which implement the addressing communication function to solve the problem of low addressing efficiency and accuracy in the existing addressing communication method.

[0006] In a first aspect, embodiments of the present application provide an addressing communication method, which is applied to a client. The client is located within a preset local area network, and there are at least one service instance of a target service within the preset local area network. The method includes:

[0007] Obtain the client identifier of the client and the service identifier of the target service;

[0008] Generate a first private layer packet header based on the client identifier, service identifier, and general 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 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;

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

[0011] Determine a target service instance for communicating with the client from at least one service instance according to the feedback time of 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 general instance identifier, and the first private layer header and the original addressing request packet are encapsulated to obtain a first private layer packet; a first link layer header is generated based on the physical address of the client and a preset broadcast address, and the first link layer header and the first private layer packet are encapsulated to obtain a target addressing request packet; the target addressing request packet is broadcast within a preset local area network, so that at least one service instance feeds back an addressing response packet of the target addressing request packet; a target service instance for communicating with the client is determined from at least one service instance according to the feedback time of at least one service instance, realizing the addressing communication function. In the above technical solution, the header of the private layer is generated by the client identifier, the service identifier and the general instance identifier, and the private layer is encapsulated in combination with the original addressing request packet, and then the data link layer is encapsulated and the target addressing request packet is broadcast within a preset local area network, so that the addressing request can be sent to all service instances of the target service, thereby improving the addressing efficiency. Then, further according to the feedback time of the service instance feeding back the addressing response packet, the target service instance with the optimal performance is determined from at least one service instance, realizing the addressing of the target service instance and improving the addressing accuracy. Moreover, since the service identifier and the instance identifier are fixed and unchanged, after the target service instance is addressed, positioning the target service instance through the service identifier and the instance identifier of the target service instance will not cause the problem of abnormal service instance positioning due to the change of the instance identifier, effectively avoiding the problem of abnormal service instance positioning due to time difference and further improving the addressing accuracy; in addition, only one request and response process is required between the client and the target service instance to establish communication, reducing the connection time consumption of TCP communication, thereby reducing the network delay and improving the communication efficiency.

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

[0014] An obtaining module, configured to obtain the client identifier of the client and the service identifier of the target service;

[0015] The first encapsulation module is used to generate a first private layer packet header based on the client identifier, service identifier, and general 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;

[0016] The second encapsulation module is used 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;

[0017] The sending module is used to broadcast the target addressing request data packet within a preset local area network so that at least one service instance can feedback an addressing response data packet of the target addressing request data packet;

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

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

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

[0021] 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 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, on which a computer program is stored, and when the program is executed by a processor, it implements the addressing communication method of any embodiment of the present application.

[0023] For the descriptions of the second aspect, third aspect, and fourth aspect in the present application, reference can be made to the detailed description of the first aspect; and for the beneficial effects described in the second aspect, third aspect, and fourth aspect, reference can be made to the beneficial effect analysis of the first aspect, which will not be elaborated here.

[0024] In the present application, the names of the above-mentioned addressing communication devices do not limit the devices or functional modules themselves. In actual implementation, these devices or functional modules may appear under other names. As long as the functions of each device or functional module are similar to those of the present application and fall within the scope of the claims of the present application and their equivalent technologies.

[0025] These aspects or other aspects of the present application will be more clearly understood in the following description. Description of the Drawings

[0026] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0027] Figure 1 It is a schematic flowchart of an addressing communication method provided by an embodiment of the present application;

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

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

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

[0031] Figure 5 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners

[0032] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, rather than all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

[0033] It should be noted that the terms "first", "second", "target", and "original" in the specification, claims, and drawings of the present application are used to distinguish similar objects and do not necessarily describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present application described here can be implemented in an order other than those illustrated or described here. In addition, the terms "include", "have", and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.

[0034] Figure 1It is a schematic flowchart of an addressing communication method provided by an embodiment of the present application. This embodiment can be applied to scenarios where addressing communication is required between hosts within the same local area network. An addressing communication method provided by this embodiment can be executed by an addressing communication device provided by an embodiment of the present application, and this device can be implemented in software and / or hardware. In a specific embodiment, this addressing communication device can be integrated into an electronic device, and this electronic device can be a client. For example, this 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] Among them, the client is located within a preset local area network, and there is at least one service instance of the target service within the preset local area network. The client identifier is the unique identifier of the client. Exemplarily, the client identifier can be represented in the form of text, letters, or numbers, etc.

[0037] The target service is a specific network service that the client expects to access and interact with, and is implemented based on network protocols and corresponding software programs, and can provide specific functions for the client or meet certain business requirements; the service identifier is a pre-defined identifier, which is the unique identifier of the target service. Exemplarily, the service identifier can be represented in the form of text, letters, or numbers, etc.

[0038] The service instance is a specific running instance of the target service, which is the deployment and operation presentation of the target service in a specific network environment; at least one service instance of the target service can be deployed on the same host or on different hosts. In this embodiment of the present application, the case where the service instances are deployed on different hosts is taken as an example for explanation; each service instance has independent resources such as a process space and a memory area, and can independently process requests from the client or execute corresponding business logics.

[0039] Specifically, when the client needs to address the service instance corresponding to the target service within the preset local area network, it can obtain its own identifier to get 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 and includes the service identifiers 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, service identifier, and general 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] Among them, the instance identifier is a predefined identifier and is the unique identifier of the service instance. Exemplarily, the instance identifier can be represented in the form of text, letters, or numbers, etc. The general instance identifier is a preset instance identifier used to represent all service instances; Exemplarily, the general instance identifier can be 0.

[0043] The first private layer packet header is the header information obtained by encapsulating the client identifier, service identifier, and general instance identifier at the private layer.

[0044] The original addressing request data packet is a data packet generated by the client and used to carry a specific addressing request; Optionally, the original addressing request data packet can be a data packet obtained after the client performs application layer encapsulation, including an application layer packet header and a data body, where the data body is used to carry a specific addressing request; The application layer is a network protocol layer in the standard network protocol stack; The standard network protocol stack can 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 is determined whether the addressing request data involves the interaction of the application layer protocol. If the addressing request data involves the interaction of the application layer protocol, then the addressing request data is encapsulated at the application layer, that is, the header information of the application layer is determined, such as the protocol version number and uniform resource locator, etc., and these header information are encapsulated at the application layer to obtain the application layer packet header, and then the application layer packet header is added before the addressing request data to obtain the original addressing request data packet; If the addressing request data does not involve the interaction of the application layer protocol, it indicates that the addressing request data does not need to be encapsulated at the application layer. At this time, the addressing request data can be directly used as the original addressing request data packet.

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

[0048] Optionally, the private communication protocol is a custom communication protocol; the private layer is the network protocol layer corresponding to the private communication protocol, located above the data link layer and below the application layer; for example Figure 2 The following is an example diagram of the message format of the private communication protocol provided by the embodiment of the present application. Figure 2 The message format of the private communication protocol in it 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; among them, when the initiating end of the data packet is the 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 initiating end of the data packet is the 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 the data body to ensure the integrity and accuracy of the data during transmission. It should be noted that algorithms such as binary one's complement summation or cyclic redundancy check can be used to generate the checksum, which is the same as the method for generating the checksum in the prior art and will not be elaborated here.

[0049] By representing the request end address through the client identifier, it can be dynamically bound to the identity ticket of the client, providing a frame-level means for request authentication of the service instance at the network layer and the transport layer, and at the same time providing a guarantee mechanism for the security of the underlying communication of the service instance; by representing the service response end address through the service identifier and the instance identifier, the service and the corresponding service instance can be located, and then the ability to directly locate for service running state monitoring and service performance monitoring can be provided.

[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 the port number can be located, but the specific service instance cannot be determined through the IP address and the port number. It is necessary to install a plugin on the host corresponding to the IP address to collect the communication data of the service instance, so as to determine the communication state and the working state of the service instance, and realize service running state monitoring and service performance monitoring. Moreover, since the IP address and the port number are dynamically changing, there may be a problem of abnormal service location due to time difference for the monitored and collected communication data, especially the cutover during service exception causes missing or incorrect collection and analysis of operation and maintenance data; however, in the embodiment of the present application, through the service identifier and the instance identifier obtained by parsing the data packets of the private layer, the service and the specific service instance can be directly located, 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, realizing service running state monitoring and service performance monitoring. There is no need to install a plugin on the server side to monitor the state of the service instance, and it can be decoupled from the service instance. At the same time, the problem of abnormal service location due to time difference can be avoided, thereby improving the monitoring efficiency and accuracy.

[0051] Further, generate a first private layer packet header based on the client identifier, service identifier, and general 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, including Sa1 - Sa2:

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

[0053] Specifically, the client identifier can be used as the source address of the private layer, and the service identifier and general instance identifier can be used as the destination address of the private layer for encapsulating the packet header of the private layer to obtain the first private layer packet header. Thus, all service instances of the target service within the preset local area network can receive the data packet with the instance identifier being the general instance identifier; for example, given that the client identifier is a, the service identifier of the target service is service1, and the general instance identifier is 0, the source address of the first private layer packet header is a, and the destination address is service1 - 0.

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

[0055] In the embodiment of the present application, by using the client identifier as the source address of the private layer and the service identifier and general instance identifier as the destination address of the private layer, the first private layer data packet can be sent to all service instances of the target service within the preset local area network, enabling all service instances of the target service to receive the addressing request from the client. Furthermore, the determination efficiency and determination accuracy of the first private layer data packet are improved, providing an accurate data basis for generating the target addressing request data packet subsequently, thereby improving the addressing efficiency and accuracy.

[0056] S130. 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 the target addressing request data packet.

[0057] Among them, the preset broadcast address is a pre - set broadcast address used to send data to all hosts within the preset local area network; for example, the preset broadcast address can be 00 - 00 - 00 - 00 - 00 - 00.

[0058] The first link layer packet header is the header information obtained by encapsulating the physical address of the client and the preset broadcast address. The target addressing request data packet is the data packet obtained by performing data link layer encapsulation on the first link layer packet header and the first private layer data packet.

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

[0060] Optionally, as Figure 3 shown is an example diagram of the message format of the Ethernet communication protocol provided by an embodiment of the present application. Figure 3 The message format of the Ethernet communication protocol in it includes a preamble, a start frame delimiter, a header, a data body, and a frame check. The header includes a source address, a destination address, and a frame type; the source address therein is the physical address of the initiating end, the destination address is the physical address of the receiving end, the data body is the data packet after private layer encapsulation, the preamble is used to help the initiating end perform clock synchronization at the physical layer, the start frame delimiter is used to indicate the start position of the Ethernet frame, and the frame check is used to check the header and the data body to ensure the integrity and accuracy of the data during transmission.

[0061] Furthermore, 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, and the first link layer packet header is added before the first private layer data packet to obtain a target addressing request packet. By using the preset broadcast address as the destination address of the data link layer, the target addressing request packet can be sent to all hosts within the preset local area network, so that all the hosts where the service instances of the target service are located can receive the addressing request of the client, thereby improving the addressing efficiency and accuracy.

[0062] Optionally, the frame type corresponding to the private communication protocol can be preset as a preset frame type. Thus, 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 running state monitoring and service performance monitoring.

[0063] S140. Broadcast the target addressing request packet within the preset local area network so that at least one service instance feeds back an addressing response packet for the target addressing request packet.

[0064] Among them, the addressing response data packet is the response data packet generated by the service instance for the target addressing request data packet; one service instance corresponds to one addressing response data packet, that is, all service instances of the target service can generate addressing response data packets. It should be noted that when a service instance has an exception, this service instance will not generate an addressing response data packet.

[0065] Optionally, the source address of the private layer in the addressing 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 addressing response data packet is the client identifier, the source address of the data link layer in the addressing 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 addressing 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 (such as network cable or wireless electromagnetic wave) within the preset local area network, so as to broadcast the target addressing request data packet within the preset local area network; then, all hosts within the preset local area network can receive the target addressing request data packet, so that all service instances of the target service within the preset local area network receive the addressing request from the client.

[0067] The host where the service instance of the target service is located can receive data packets. At this time, the data packets include the target addressing request data packet sent by the client and also 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 of the target service and the general instance identifier, it is determined that the data packet is the target addressing request data packet sent by the client; otherwise, it is determined that the data packet is 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 physical address of the client, the client identifier, and the addressing request data obtained by parsing the target addressing request data packet, and generate the addressing response data for the addressing request data. Secondly, perform application layer encapsulation on the addressing response data to obtain the original addressing response data packet. Then, use the service identifier of the target service and the instance identifier of this service instance as the source address of the private layer, use the client identifier as the destination address of the private layer, generate the response private layer packet header, and add the response private layer packet header to the front of the original addressing response data packet to obtain the response private layer data packet. Next, use the physical address of this host as the source address of the data link layer, use the physical address of the client as the destination address of the data link layer, use the preset frame type as the frame type of the data link layer, generate the response data link layer packet header, and add the response data link layer packet header to the front of the response private layer data packet to obtain the addressing response data packet. After that, send the addressing response data packet to the client through the physical layer.

[0069] S150. Determine the target service instance that communicates with the client from at least one service instance according to the feedback time of at least one service instance.

[0070] Among them, the feedback time is used to characterize the feedback performance of the service instance. Exemplarily, the feedback time can be the packet reception time when the client receives the addressing response data packet, or the packet sending time when the host where the service instance is located sends the addressing response data packet.

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

[0072] Specifically, it is possible to receive the addressing response data packets fed back by at least one service instance and determine the feedback time of at least one service instance. In one implementation, the packet reception time of each addressing response data packet can be recorded, and then the packet reception time is determined as the feedback time corresponding to the addressing response data packet, that is, the feedback time of the corresponding service instance. In another implementation, when the host where the service instance is located sends the addressing response data packet, it can carry the packet sending time. Thus, after the client receives the addressing response data packets fed back by at least one service instance, it can determine the packet sending time as the feedback time corresponding to the addressing response data packet, that is, the feedback time of the corresponding service instance.

[0073] Then, it is possible to determine the target service instance that communicates with the client from at least one service instance according to the feedback time and the addressing response data packet. For example, in one implementation, sort the feedback times from smallest to largest to obtain the sorting result, and select any one of the feedback times from the top three of the sorting result. Then, extract the instance identifier from the addressing response data packet corresponding to this feedback time, and determine the service instance corresponding to this instance identifier as the target service instance.

[0074] In another implementation, the minimum feedback time can be determined from the feedback times of at least one service instance. The minimum feedback time is the minimum value among the feedback times of at least one service instance. Then, the instance identifier is 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 through the addressing response packet corresponding to the minimum feedback time, the service instance with the optimal performance can be accurately determined, thereby realizing the addressing of the target service instance and improving the addressing accuracy.

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

[0076] Optionally, after determining the target service instance for communicating with the client from at least one service instance according to the feedback time of at least one service instance, the client can communicate with the target service instance, that is: (1) perform application layer encapsulation. Specifically, generate business request data such as acquisition instructions (e.g., Structured Query Language (SQL) statements), and determine the header information of the application layer, such as protocol version number and Uniform Resource Locator (URL), etc., generate the application layer packet header, and then add the application layer packet header before the business request data to obtain the original business request data packet, where the original business request data packet is used to inform the target service instance of relevant information such as the operation to be performed or the resources to be feedback; (2) perform private layer encapsulation. Specifically, use the client identifier as the source address of the private layer, use the service identifier and the instance identifier of the target service instance as the destination address of the private layer, generate the second private layer packet header, and add the second private layer packet header before the original business request data packet to obtain the second private layer data packet; (3) perform data link layer encapsulation. Specifically, use the physical address of the client as the source address of the data link layer, use the physical address of the host where the target service instance is located as the destination address of the data link layer, use the preset frame type as the frame type of the data link layer, generate the second link layer packet header, and add the second link layer packet header before the second private layer data packet to obtain the target business request data packet; (4) send 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 feeds back the service 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, then parse the target business request data packet to obtain the business request data, and generate the service response data corresponding to the business request data (such as the data corresponding to the SQL statement or the operation execution result), then sequentially perform application layer, private layer, and data link layer encapsulation on the service response data to obtain the service response data packet, and send the service response data packet to the client; where the source address of the private layer in the service 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 packets 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 the embodiments 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, and thus the communication between the client and the target service instance can be realized; moreover, the client can receive only the data packets with its own client identifier through BPF, and the target service instance can receive only the data packets with the service identifier of the target service and its own instance identifier through BPF, realizing the two-way duplex data communication between the client and the target service instance.

[0079] The technical solution of the embodiments 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, the service identifier and the general 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, realizing the addressing communication function. In the above technical solution, by generating the header of the private layer through the client identifier, the service identifier and the general instance identifier, and combining with the original addressing request data packet for the encapsulation of the private layer, then performing the encapsulation of the data link layer and broadcasting the target addressing request data packet in the preset local area network, the addressing request can be sent to all service instances of the target service, thereby improving the addressing efficiency. Then, further according to the feedback time of the service instance feeding back the addressing response data packet, the target service instance with the optimal performance is determined from at least one service instance, realizing the addressing of the target service instance and improving the addressing accuracy. Moreover, since the service identifier and the instance identifier are fixed and unchanged, after the target service instance is addressed, by positioning the target service instance through the service identifier and the instance identifier of the target service instance, there will be no problem of abnormal service instance positioning caused by the change of the instance identifier, effectively avoiding the problem of abnormal service instance positioning caused by time difference and further improving the addressing accuracy; in addition, the client and the target service instance only need one request and response process to establish communication, reducing the connection time consumption of TCP communication, thereby reducing the network delay and improving the communication efficiency.

[0080] Figure 4 is a schematic structural diagram of an addressing communication device provided by an embodiment of the present application. Refer to Figure 4 and the addressing communication device may include:

[0081] An obtaining module 410, configured to obtain the client identifier of the client and the service identifier of the target service;

[0082] The first encapsulation module 420 is used to generate a first private layer header based on the client identifier, service identifier, and general 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 used to generate a first link layer header based on the physical address of the client and a 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 used to broadcast the target addressing request data packet within 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 determining module 450 is used to determine a target service instance communicating with the client from at least one service instance according to the feedback time of at least one service instance.

[0086] In one embodiment, the first encapsulation module 420 is specifically used for:

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

[0088] Adding the first private layer header before the original addressing request data packet to obtain a first private layer data packet.

[0089] In one embodiment, the second encapsulation module 430 is specifically used for:

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

[0091] Adding the first link layer header before 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 addressing 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 addressing response data packet is the client identifier, the source address of the data link layer in the addressing 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 addressing response data packet is the physical address of the client.

[0093] In one embodiment, the determining module 450 is specifically used for:

[0094] Determining the minimum feedback time from the feedback times of at least one service instance;

[0095] Extract the instance identifier from the addressing response data packet corresponding to the minimum feedback time, and determine the service instance corresponding to the instance identifier as the target service instance.

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

[0097] After determining 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, use the client identifier as the source address of the private layer, use the service identifier and the instance identifier of the target service instance as the destination address of the private layer, generate a second private layer header, and add the second private layer header before the original service request data packet to obtain a second private layer data packet;

[0098] Use the physical address of the client as the source address of the data link layer, use the physical address of the host where the target service instance is located as the destination address of the data link layer, generate a second link layer header, and add the second link layer header before the second private layer data packet to obtain a target service request data packet;

[0099] Send the 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 of the target service request data packet.

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

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

[0102] Filter the network data packets based on a preset filtering rule, and identify the addressing response data packets sent by at least one service instance 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 can clearly understand that for the convenience and simplicity of description, only the above division of each functional module is used as an example. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the above-described functional modules can refer to the corresponding process in the foregoing method embodiments, and will not be elaborated herein.

[0104] The addressing communication device provided in this embodiment is applicable 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 schematic structural diagram of an electronic device provided in an embodiment of the present application.Figure 5 The block diagram of an exemplary electronic device 11 suitable for implementing the embodiments of the present application is shown. Figure 5 The displayed electronic device 11 is merely an example and should not impose any limitations on the functions and usage scope of this embodiment.

[0106] As Figure 5 shown, the electronic device 11 is presented in the form of a general-purpose computing electronic device. The components of the electronic device 11 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 connecting different system components (including the system memory 28 and the processing unit 16).

[0107] The bus 18 represents one or more of several types of bus structures, including a memory bus or a memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus structures. By way of example, these architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and 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 accessible 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, a storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 5 not shown, commonly referred to as a "hard disk drive"). Although Figure 5 not shown in the figure, a disk drive for reading and writing removable non-volatile disks (such as "floppy disks") and an optical disk drive for reading and writing removable non-volatile optical disks (such as CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 through one or more data media interfaces. The system memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present application.

[0110] A program / utilities 40 having a set (at least one) of program modules 42 can be stored, for example, in the 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 or some combination of these examples may include the implementation of a network environment. The program modules 42 generally execute the functions and / or methods in the embodiments described in the present application.

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

[0112] As Figure 5 shown, the network adapter 20 communicates with other modules of the electronic device 11 through the bus 18. It should be understood that although Figure 5 not shown in the figure, other hardware and / or software modules can be used in combination 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, etc.

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

[0114] Obtain the client identifier of the client and the service identifier of the target service;

[0115] Generate a first private layer packet header based on the client identifier, the service identifier, and the general 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 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;

[0117] 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;

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

[0119] Of course, those skilled in the art can understand that the processor can also implement the technical solutions 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, on which a computer program is stored. When the program is executed by a processor, it implements, for example, an addressing communication method provided in an embodiment of the present application, which is applied to a client located in a preset local area network. There are at least one service instance of a target service in the preset local area network. The method includes:

[0121] Obtain the client identifier of the client and the service identifier of the target service;

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

[0123] 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;

[0124] 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;

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

[0126] The computer storage medium of this embodiment may adopt any combination of one or more computer-readable media. The computer-readable media can be computer-readable signal media or computer-readable storage media. The computer-readable storage media can be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (non-exhaustive list) of the computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, the computer-readable storage media can be any tangible medium that contains or stores a program, and this program can be used by or in combination with an instruction execution system, apparatus, or device.

[0127] The computer-readable signal media may include data signals propagated in a baseband or as part of a carrier wave, which carry computer-readable program codes. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal media can also be any computer-readable media other than the computer-readable storage media, and this computer-readable media can send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device.

[0128] The program codes contained on the computer-readable media can be transmitted by any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0129] The computer program codes for performing the operations of this application can be written in one or more programming languages or combinations thereof. The programming languages include object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages - such as the "C" language or similar programming languages. The program codes can be executed entirely on the user's computer, partially on the user's computer, executed as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of 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 (for example, by using an Internet service provider to connect through the Internet).

[0130] Those of ordinary skill in the art should understand that the various modules or steps of the present application described above can be implemented using a general-purpose computing device. They can be concentrated on a single computing device or distributed across a network composed of multiple computing devices. Optionally, 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 separately fabricated into individual integrated circuit modules, or multiple modules or steps among them 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, processing, etc. of data in the technical solution of the present application all comply with the relevant provisions of national laws and regulations.

[0132] Note that the above is only the preferred embodiment of the present application and the technical principles applied. Those skilled in the art will understand that the present application is not limited to the specific embodiments here, and various obvious changes, re-adjustments, and substitutions can be made by those skilled in the art without departing from the protection scope 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. Without departing from the inventive concept of the present application, more other equivalent embodiments can be included, 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 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: 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, characterized in that: The step of generating a first private layer header based on the client identifier, the service identifier, and the universal instance identifier, and encapsulating the first private layer 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, using the service identifier and the universal instance identifier as the destination address of the private layer, and generating 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, characterized in that: The step of generating a first link layer header based on the physical address of the client and a preset broadcast address, and encapsulating the first link layer 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 packet 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, characterized in that: 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 step of 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 comprises: 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, using 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 header, and adding the second link layer 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 time 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 an 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 comprises: An acquisition module, used to acquire a client identifier of the client and a service identifier of the target service; A first encapsulation module, configured to generate a first private layer header based on the client identifier, the service identifier, and the universal instance identifier, and to encapsulate the first private layer header and the original addressing request data packet to obtain a first private layer data packet; A second encapsulation module is used to generate a first link layer header based on the physical address of the client and a 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; 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; The determination module is used 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.

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 so that the at least one processor can 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

  • Transmission method and system for layered virtual private local area network business

    CN102739498A

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

    CN112003926A

  • Alliance chain supervision system-oriented addressing route synchronization method and related device

    CN113242317A

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

    CN115834194A

  • Addressing method and device, equipment and storage medium

    CN116319966A

Cited By

  • Vehicle-mounted communication system, vehicle-mounted communication method and vehicle

    CN120512489A