Object communication method and device, medium, electronic equipment and program product
By obtaining the object identification and communication address of the target object, object-level communication is realized, which solves the problems of complex and poor scalability of existing process-level communication, simplifies the communication process and improves the scalability of the system.
Patent Information
- Application Number
- CN202411836603.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-03-04
AI Technical Summary
The process-level communication methods inside existing game servers are complex and have poor scalability. The sender needs to select the target process based on the number of processes and location of the receiver, resulting in cumbersome communication process.
By obtaining the object identifier of the target object, obtaining its communication address from the database, and sending communication messages based on the address, object-level communication is realized, and complex operations of inter-process communication are avoided.
The communication process is simplified, the communication overhead is reduced, and the system is improved. Even if new processes or objects are added, the communication of other objects will not be affected.
Smart Images

Figure CN119557123A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of communication technology, and in particular, to an object communication method, device, medium, electronic device and program product. Background Art
[0002] At present, the communication within the game server is generally process-level communication. Generally speaking, a TCP (Transmission Control Protocol) connection is established between the processes that need to communicate, and then messages are sent and received through the TCP connection. However, in this communication method, when the sender sends a message, there is a process of finding the target process based on the recipient of the message. This process is often cumbersome and has poor scalability. For example, using consistent hashing to find the target process requires the sender to know the number of target processes. When the number of processes changes, it is easy to cause the wrong target process selection. Summary of the invention
[0003] This summary is provided to introduce concepts in a brief form that will be described in detail in the detailed description below. This summary is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0004] In a first aspect, the present disclosure provides an object communication method, comprising: Obtaining a communication message sent by a message sender to a target object, wherein the target object is an object running in a process; According to the object identifier of the target object, acquiring the communication address of the target object from a database, wherein when the target object moves from one process to another process, the communication address of the target object in the current process is stored in the database; The communication message is sent to the target object according to the communication address.
[0005] In a second aspect, the present disclosure provides an object communication device, including: A first acquisition module is configured to acquire a communication message sent by a message sender to a target object, where the target object is an object running in a process; A second acquisition module is configured to acquire a communication address of the target object from a database according to the object identifier of the target object, wherein when the target object moves from one process to another, the communication address of the target object in the current process is stored in the database; The sending module is configured to send the communication message to the target object according to the communication address.
[0006] In a third aspect, the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of the method described in the first aspect.
[0007] In a fourth aspect, the present disclosure provides an electronic device, including: a storage device having a computer program stored thereon; A processing device is used to execute the computer program in the storage device to implement the steps of the method described in the first aspect.
[0008] In a fifth aspect, the present disclosure provides a computer program product, including a computer program, which implements the steps of the method described in the first aspect when executed by a processor.
[0009] Based on the above technical solution, by obtaining the communication message sent by the message sender to the target object, and then obtaining the communication address of the target object from the database according to the object identifier of the target object, and sending the communication message to the target object according to the communication address, not only can more fine-grained object-level communication be achieved, avoiding the complex operation of inter-process communication, but also for the message sender, there is no need to care about the communication details of the target object, and the message can be sent by relying on the object identifier of the target object, which greatly simplifies the communication process and reduces the communication overhead. In addition, since the message can be sent by relying on the object identifier of the target object, the communication system can have high scalability. Even if a new process or object is added to the communication system, it will not cause changes in the communication of other objects.
[0010] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale. In the drawings: Figure 1 is a flowchart of an object communication method according to some embodiments.
[0012] Figure 2 is a flowchart illustrating object registration according to some embodiments.
[0013] Figure 3 is a flow chart illustrating sending a communication message according to some embodiments.
[0014] Figure 4 FIG. 4 is a flowchart of sending a communication message according to yet other embodiments.
[0015] Figure 5 is a schematic diagram of the structure of an object communication device according to some embodiments.
[0016] Figure 6 is a schematic diagram of the structure of an electronic device according to some embodiments. DETAILED DESCRIPTION
[0017] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0018] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0019] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0020] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0021] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0022] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0023] Figure 1 FIG. 1 is a flow chart of an object communication method according to some embodiments. Figure 1As shown, the embodiment of the present disclosure provides an object communication method, which can be executed by an electronic device, specifically, by an object communication device, which can be implemented by software and / or hardware and configured in the electronic device. Figure 1 As shown, the method may include the following steps.
[0024] In step 110, a communication message sent by a message sender to a target object is obtained, where the target object is an object running in a process.
[0025] Here, an object may refer to an instance running in a process. Taking the server of a game as an example, each map in the game scene can be understood as a process in the server, and a player character in the map can be understood as an object in the process (map). In the embodiment of the present disclosure, the dimension of the object communication method is the object level, that is, the communication target can be an object in the process, not the process.
[0026] The message sender can be an object, a process, etc. In a communication system, any role that needs to send a communication message to an object for propagation or exchange of information can be a message sender. For example, in a game, if player character A sends a communication message to player character B, then player character A is the message sender.
[0027] When the message sender sends a communication message to the target object, the message sender may carry the object identifier of the target object in the communication message to be sent to the target object, and the object identifier is used to indicate the target object to receive the communication message.
[0028] The object identification may refer to a unique identifier (ID) of the target object. It should be understood that in the embodiments of the present disclosure, the object identification of each object is globally unique in the communication system. For example, the object identification of object A running in electronic device A is different from the object identification of object B running in electronic device B.
[0029] In step 120, the communication address of the target object is obtained from the database according to the object identification of the target object, wherein when the target object moves from one process to another, the communication address of the target object in the current process is stored in the database.
[0030] Here, the database is used to store the communication addresses of all objects in the communication system. The database can store the communication addresses of the objects in the form of "object identifier-communication address". The communication address of the object may include the address of the electronic device where the object is located and the address of the process where the object is located. The communication message can be accurately routed to the electronic device where the object is located through the address of the electronic device, and the communication message can be accurately routed to the process where the object is located through the address of the process, so that the process routes the communication message to the object.
[0031] After the communication message is obtained, the object identifier of the target object can be obtained from the communication message, and then the communication address of the target object can be queried in the database according to the object identifier.
[0032] It is worth noting that since the target object runs in the process, when the target object is transferred between processes, the process on which the target object depends will also change. For example, in a game, when the player character (target object) moves from one map to another, it can actually be understood as the player character moving from one map process to another map process.
[0033] Therefore, when the target object moves from one process to another, the communication address of the target object will change. At this time, the communication address of the target object in the current process can be stored in the database. Wherein, the communication address of the target object in the current process can be updated in the database by the target object.
[0034] It is worth noting that the target object moving from one process to another process may refer to the target object moving between different processes of the same electronic device. Of course, the target object moving from one process to another process may also refer to the target object moving between processes of different electronic devices. For example, an object running in process A of electronic device A may be moved to process B of electronic device B. In other words, the target object moving from one process to another process may be moving between the same electronic device or moving across electronic devices.
[0035] It should be understood that since the communication address of each object is stored in the database, the message sender can send a communication message to the target object as long as the object identifier of the target object is known, without having to worry about which process the target object is in, or the process's IP (Internet Protocol) address and port number and other communication details.
[0036] For example, taking the game server as an example, when object A running on map process A sends a communication message to object B running on map process B, object A does not need to know that object B is running on map process B, let alone the IP address and port number of map process B. Object A only needs to know the object ID of object B.
[0037] In step 130, a communication message is sent to the target object according to the communication address.
[0038] Here, after obtaining the communication address of the target object based on the object identifier of the target object, communication information is sent to the target object based on the communication address to achieve communication between the message sender and the target object, thereby achieving object-level communication.
[0039] In the case where sending a communication message to the target object according to the communication address fails, a new communication address of the target object can be obtained from the database again according to the object identifier, and a communication message can be sent to the target object according to the new communication address.
[0040] It should be understood that since the target object may move between processes, in the process of sending a communication message to the target object according to the communication address, the target object may have moved from the process corresponding to the original communication address to another process, resulting in the communication message being unable to be sent to the target object.
[0041] At this time, if sending a communication message to the target object according to the communication address fails, a new communication address of the target object can be re-acquired from the database to ensure that the target object can successfully receive the communication message sent by the message sender.
[0042] Therefore, by obtaining the communication message sent by the message sender to the target object, and then obtaining the communication address of the target object from the database according to the object identifier of the target object, and sending the communication message to the target object according to the communication address, not only can more fine-grained object-level communication be achieved, avoiding the complex operation of inter-process communication, but also for the message sender, there is no need to care about the communication details of the target object, and the message can be sent by relying on the object identifier of the target object, which greatly simplifies the communication process and reduces the communication overhead. In addition, since the message can be sent by relying on the object identifier of the target object, the communication system can have high scalability. Even if a new process or object is added to the communication system, it will not cause changes in the communication of other objects.
[0043] In some achievable implementations, the first message management process can receive registration information sent by an object running on the same electronic device as the first message management process, respond to the registration information through the first message management process, use the communication address of the first message management process as the communication address of the object, store the communication address and object identifier of the object in a database, and store the mapping relationship between the object identifier and the process identifier in the first message management process.
[0044] Here, for each electronic device in the communication system, a message management process may be run in the electronic device, and the message management process is used to receive a communication message sent by a message sender to a target object, and forward the communication information to the corresponding target object according to the communication address. The first message management process is a message management process running on the electronic device. In order to realize object-level communication, the object running on the process of each electronic device needs to register with the corresponding first message management process.
[0045] An object running on the same electronic device as the first message management process can send registration information to the first message management process, and the first message management process receives the registration information.
[0046] The registration information includes the object identifier of the object and the process identifier corresponding to the process where the object exists.
[0047] It should be noted that the object identifier is globally unique in the communication system, and the process identifier can be globally unique in the communication system. Of course, the process identifier may not be globally unique in the communication system. The process identifier only needs to be unique in an electronic device, and can be set according to specific needs.
[0048] The first message management process responds to the registration information sent by the object, uses the communication address of the first message management process as the communication address of the object, and stores the communication address and object identifier of the object in the database. Therefore, the communication address of the object is actually the communication address of the message management process running in the same electronic device as the object. The communication address of the message management process may include the address of the electronic device where the message management process is located and the address of the message management process.
[0049] Furthermore, the first message management process responds to the registration information sent by the object and stores the mapping relationship between the object identifier and the process identifier in the first message management process.
[0050] It is understandable that each message management process maintains a mapping relationship with an object running on the same electronic device as the message management process. When the object no longer runs on the same electronic device as the message management process, the message management process no longer maintains the mapping relationship of the object. Therefore, if there is no mapping relationship for a certain object in the message management process, it means that the object has been transferred to the process of other electronic devices or that the object state of the object has changed. For example, in a game scene, if the player character is offline, there will be no mapping relationship for the object corresponding to the player character in the corresponding message management process. For another example, in a game scene, if a non-player character has been defeated by the player, the object state of the non-player character will be changed to "offline state / logout state / deletion state", and accordingly, there will be no mapping relationship for the object corresponding to the non-player character in the corresponding message management process.
[0051] It is worth noting that, by sending registration information to the first message management process, the object can inform all message senders in the communication system of the object's communication address, so that the message senders can communicate with the object in the case of relying on the object identifier. Of course, after the object sends the registration information to the first message management process, the communication system can also send the object identifier of the object to the subscription target through the subscription mechanism, so that the subscription target can communicate with the specific object based on the object identifier. For example, the subscription target can subscribe to obtain the object identifier of a specific type of object. After the specific type of object is registered in the message management process, the communication system pushes the object identifier of the specific type of object to the subscription target.
[0052] It should be understood that by using the communication address of the first message management process as the communication address of the object, the first message management process can receive the communication message sent by the message sender, and then forward the communication message to the object. Therefore, the communication details such as how to find the target object and how to forward the communication message to the target object are all handled by the first message management process, without the need for the message sender to handle it. The message sender only needs to know the object identifier corresponding to the object that needs to communicate.
[0053] Figure 2 FIG. 4 is a flowchart showing object registration according to some embodiments. Figure 2 As shown, object registration can be performed through the following steps.
[0054] S201, the object sends registration information to a first message management process located in the same electronic device; S202, the first message management process stores a mapping relationship between an object identifier and a process identifier; S203, the first message management process stores the communication address and object identifier of the object in the database; S204, the database notifies the first message management process that storage is successful; S205: The first message management process notifies the object that registration is successful.
[0055] The object registers with the first message management process running on the same electronic device, notifying the first message management process of the object's corresponding object ID and process ID. In the subsequent process, the message sender can send a communication message to the object based on the object ID. For example, the message sender who needs to send a communication message to the object can send the communication message to the first message management process through the object ID. After the first message management process receives the communication message sent by the message sender to the object, the first message management process can forward the communication message to the object based on the mapping relationship.
[0056] Therefore, through the above implementation, object-level communication can be achieved, and the message sender does not need to care about the communication details, and the object-level communication can be completed by relying on the object identifier of the target object.
[0057] In some feasible implementations, in step 130, a communication message may be sent through the first message management process to a second message management process corresponding to the communication address of the target object.
[0058] Here, the message sender and the first message management process are in the same electronic device, and the communication message sent by the message sender to the target object can be forwarded to the target object through the first message management process.
[0059] The second message management process may be a message management process running on other electronic devices, and the functions implemented by the first message management process and the second message management process are consistent. Of course, the second message management process may also be the first message management process in some cases.
[0060] For example, when the communication address of the target object is the communication address of the first message management process, the second message management process corresponding to the communication address of the target object is the first message management process.
[0061] It should be noted that the first message management process and the second message management process mentioned in this disclosure are only used to distinguish the roles of different message management processes. The second message management process is equivalent to a destination message management process, which can be the first message management process or a message management process running on other electronic devices.
[0062] The communication address of the object is the communication address of the message management process running on the same electronic device as the object. Therefore, the first message management process can send a communication message to the second message management process corresponding to the communication address of the target object.
[0063] The second message management process receives the communication message, and based on the object identifier in the communication message, queries the process identifier corresponding to the process where the target object is located from the mapping relationship maintained by the second message management process, and then based on the process identifier, sends the communication message to the process where the target object is located, so that the process where the target object is located routes the communication message to the target object.
[0064] The mapping relationship includes an association relationship between an object identifier corresponding to an object running on the same electronic device as the second message management process and a process identifier corresponding to the process where the object is located.
[0065] That is, for the second message management process, an object running on the same electronic device as the second message management process can send a registration message to the second message management process, so that the second message management process can store a mapping relationship between the object identifier and the process identifier.
[0066] Therefore, through the above implementation, communication details such as forwarding of communication messages and searching of target objects are handled by the message management process, so that the upper layer of communication (message sender) does not need to care about the communication details and can complete object-level communication by relying on the object identifier of the target object.
[0067] In some achievable implementations, the second message management process is further used to return the communication message to the first message management process when the second message management process fails to find the process where the target object is located. Accordingly, the first message management process can also receive the communication message returned by the second message management process, and the first message management process can query a new communication address from the database again according to the object identifier, and send the communication message to the target object according to the new communication address.
[0068] Here, since each message management process maintains a mapping relationship with an object running on the same electronic device as the message management process, when the object no longer runs on the same electronic device as the message management process, the message management process no longer maintains the mapping relationship with the object.
[0069] When the second message management process fails to find the process where the target object is located in the second message management process, it means that the second message management process does not store the mapping relationship corresponding to the target object, and accordingly, it means that the target object is no longer in the same electronic device as the second message management process. In other words, during the process of the first message management process sending a communication message to the second message management process, the target object has undergone a process switch and is no longer in the same electronic device as the second message management process, or during the process of the first message management process sending a communication message to the second message management process, the object state of the target object has changed, resulting in the second message management process being unable to query the corresponding target object.
[0070] At this time, the second message management process returns the communication message to the first message management process. The first message management process receives the communication message returned by the second message management process, and based on the object identifier of the target object, re-queries a new communication address from the database, and then sends the communication message to the target object according to the new communication address.
[0071] It should be noted that the communication address of the object maintained in the database refers to the communication address of the object active in the communication system. When the object is no longer active in the communication system, the communication address of the object will no longer be maintained in the database. For example, in a game scenario, after the player character goes offline, the player character no longer exists in the game, and the database will not continue to maintain the communication address of the player character. If the first message management process cannot query the new communication address of the target object from the database based on the object identifier of the target object, it means that the target object no longer exists in the communication system. At this time, the communication message can be discarded. For example, in a game scenario, if the player character goes offline, the communication address of the player character will not be stored in the database, and accordingly, the first message management process will not be able to query the communication address of the player character.
[0072] It should be understood that by returning the communication message to the first message management process, the first message management process continues to send the communication message to the target object, so that the order of the communication message can be guaranteed. For example, the message sender can send 3 communication messages to a target object, and these 3 communication messages are sequential. If the second message management process sends the communication message to the target object by itself, the order in which the target object receives the 3 communication messages may be out of order.
[0073] Therefore, through the above implementation, even if the communication message is mistakenly sent to the second message management process due to the process switching of the target object, the first message management process can send the communication message to the target object by re-correcting the communication address, and the message will not be lost. Moreover, by returning the communication message to the first message management process, the orderliness of the communication message can also be guaranteed.
[0074] In some feasible implementations, in step 110, a communication message sent by a message sender to a target object is obtained from a shared memory through a first message management process. Accordingly, in step 120, when the first message management process does not cache the communication address of the target object, the first message management process obtains the communication address of the target object from a database according to the object identifier of the target object, and caches the communication address in the first message management process.
[0075] Here, the first message management process and the message sender run on the same electronic device, and the first message management process and the message sender can communicate using a shared memory. Therefore, the message sender can write a communication message sent to the target object into the shared memory, and then the first message management process reads the communication message from the shared memory.
[0076] It should be understood that by using shared memory communication, not only can the communication performance be greatly improved, but even if the first message management process crashes, the communication messages will still be stored in the shared memory. After the first message management process is restarted, it can still continue to process the communication messages without causing the loss of communication messages.
[0077] In the case that the first message management process caches the communication address of the target object, the first message management process may send a communication message to the target object based on the communication address of the target object.
[0078] When the first message management process does not cache the communication address of the target object, the first message management process obtains the communication address of the target object from the database according to the object identifier of the target object, and caches the communication address in the first message management process.
[0079] It is worth noting that the communication address cached in the first message management process can be used to directly send a communication message to the target object using the communication address when a communication message to the target object is received next time.
[0080] Of course, it should be noted that if the communication message cannot be delivered to the target object based on the cached communication address, the new communication address of the target object can be obtained from the database based on the object identifier. For example, when the target object is switched, its communication address is changed, and the cached communication address is no longer valid.
[0081] Therefore, through the above implementation, by using shared memory communication, not only the communication performance can be greatly improved without causing message loss, but also the efficiency of message forwarding can be improved in subsequent processes by caching the communication address.
[0082] In some feasible implementations, when the target object and the message sender are in the same electronic device, the communication message is sent to the target object through the shared memory according to the communication address.
[0083] Here, the target object and the message sender are in the same electronic device, which means that the message sender and the message receiver are in the same electronic device. In this case, the communication message can be sent to the target object directly using the shared memory communication method.
[0084] Following the above embodiment, the first message management process can receive a communication message sent by the message sender to the target object. If the target object and the message sender are in the same electronic device, the first message management process sends the communication message to the target object through the shared memory.
[0085] The target object and the message sender are in different electronic devices, which means that the message sender and the message receiver are in different electronic devices, which belongs to cross-device communication. Accordingly, the communication message can be sent to the target object through a TCP connection.
[0086] Therefore, by sending communication messages to the target object through shared memory, the communication efficiency can be improved.
[0087] Combine the following Figure 3 and Figure 4 The above-mentioned embodiment is described.
[0088] Figure 3 FIG. 1 is a flow chart of sending a communication message according to some embodiments. Figure 3 As shown, a communication message can be sent to a target object through the following steps.
[0089] S301, the message sending direction sends a communication message to the first message management process; S302, when the first message management process has a communication address of the target object cached, the first message management process forwards the communication message to the target object based on the communication address; S303, when the first message management process does not cache the communication address of the target object, the first message management process queries the communication address of the target object from the database; S304, the database returns the communication address of the target object to the first message management process; S305, the first message management process caches the communication address of the target object; S306: The first message management process forwards the communication message to the target object based on the communication address of the target object.
[0090] Figure 4 FIG. 1 is a flow chart of sending a communication message according to some other embodiments. Figure 4 As shown, the message sender and the message management process A are in the same electronic device, and the message management process A, the message management process B and the message management process C are in different electronic devices. The communication message can be sent to the target object through the following steps: S401, the message sender sends a communication message to the message management process A; S402, the message management process A queries the communication address of the target object from the database; S403, the database returns the communication address of the target object to the message management process A; S404, if the queried communication address is the communication address of the message management process B, the message management process A forwards the communication message to the message management process B; S405, the message management process B queries the target object based on the mapping relationship. If the target object and the message management process B are not in the same electronic device, the message management process B returns the communication message to the message management process A; S406, the message management process A queries the database again for the communication address of the target object; S407, the database returns the communication address of the target object to the message management process A; S408, if the queried communication address is the communication address of the message management process C, the message management process A forwards the communication message to the message management process C; S409, querying the target object based on the mapping relationship, if the target object and the message management process B are in the same electronic device, the message management process C forwards the communication message to the target object.
[0091] It is worth noting that the object communication method provided by the embodiment of the present disclosure is applicable to both object-level communication within the same electronic device and object-level communication across electronic devices. If the message sender and the target object are in the same electronic device, the message sender sends a communication message to a first message management process located in the same electronic device, and the first message management process determines that the target object and the first message management process are in the same electronic device through the communication address of the target object, then the first message management process queries the process where the target object is located based on the mapping relationship, and then sends a communication message to the process where the target object is located through shared memory communication, and the process where the target object is located routes the communication message to the target object.
[0092] If the message sender and the target object are in different electronic devices, the message sending direction sends a communication message to the first message management process located in the same electronic device. The first message management process sends the communication message to the second message management process through the communication address of the target object. The second message management process queries the process where the target object is located based on the mapping relationship, and then sends the communication message to the process where the target object is located through shared memory communication. The process where the target object is located routes the communication message to the target object.
[0093] Figure 5 FIG. 1 is a schematic diagram showing a structure of an object communication device according to some embodiments. Figure 5 As shown, the embodiment of the present disclosure provides an object communication device 500, and the object communication device 500 includes: A first acquisition module 501 is configured to acquire a communication message sent by a message sender to a target object, where the target object is an object running in a process; A second acquisition module 502 is configured to acquire a communication address of the target object from a database according to the object identifier of the target object, wherein when the target object moves from one process to another, the communication address of the target object in the current process is stored in the database; The sending module 503 is configured to send the communication message to the target object according to the communication address.
[0094] Optionally, the sending module 503 is specifically configured to: Sending the communication message to a second message management process corresponding to the communication address of the target object through the first message management process; Among them, the second message management process is used to query the process where the target object is located from the mapping relationship maintained by the second message management process according to the object identifier, and send the communication message to the process so that the process routes the communication message to the target object; the mapping relationship includes the association relationship between the object identifier corresponding to the object running on the same electronic device as the second message management process and the process identifier corresponding to the process where the object is located.
[0095] Optionally, the second message management process is further used to return the communication message to the first message management process if the second message management process fails to query the process where the target object is located; The sending module 503 is further configured to: receiving, through the first message management process, the communication message returned by the second message management process; Through the first message management process, a new communication address is re-queried from the database according to the object identifier, and the communication message is sent to the target object according to the new communication address.
[0096] Optionally, the object communication device 500 further includes: a receiving module configured to receive, through the first message management process, registration information sent by an object running on the same electronic device as the first message management process, wherein the registration information includes an object identifier of the object and a process identifier corresponding to the process in which the object is located; The storage module is configured to respond to the registration information through the first message management process, use the communication address of the first message management process as the communication address of the object, store the communication address of the object and the object identifier in the database, and store the mapping relationship between the object identifier and the process identifier in the first message management process.
[0097] Optionally, the first acquisition module 501 is specifically configured to: Obtaining, through the first message management process, from the shared memory, a communication message sent by the message sender to the target object; The second acquisition module 502 is specifically configured to: When the first message management process does not cache the communication address of the target object, the first message management process obtains the communication address of the target object from the database according to the object identifier of the target object, and caches the communication address in the first message management process.
[0098] Optionally, the sending module 503 is specifically configured to: In the case that the target object and the message sender are in the same electronic device, the communication message is sent to the target object through a shared memory according to the communication address.
[0099] The logic of the method executed by each functional module in the object communication device 500 may refer to the method related to the above embodiment, and will not be repeated here.
[0100] Reference below Figure 6 , which shows a schematic diagram of the structure of an electronic device (eg, a server) 600 suitable for implementing the embodiment of the present disclosure. The server in the embodiment of the present disclosure may be a game server or a server of other applications, which is not specifically limited in the embodiment of the present disclosure. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0101] like Figure 6 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0102] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0103] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0104] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: 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 the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0105] In some embodiments, the electronic devices may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0106] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0107] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: obtains a communication message sent by the message sender to a target object, wherein the target object is an object running in a process; obtains a communication address of the target object from a database according to an object identifier of the target object, wherein when the target object moves from one process to another, the communication address of the target object in the current process is stored in the database; and sends the communication message to the target object according to the communication address.
[0108] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may 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 the case of a remote computer, the remote computer may 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 may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0109] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0110] The modules involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a module does not, in some cases, limit the module itself.
[0111] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0112] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, 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 foregoing.
[0113] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0114] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0115] Although the subject matter has been described in language specific to structural features and / or method logic actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims. Regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Claims
1. An object communication method, characterized in that: include: Obtaining a communication message sent by a message sender to a target object, wherein the target object is an object running in a process; According to the object identifier of the target object, acquiring the communication address of the target object from a database, wherein when the target object moves from one process to another process, the communication address of the target object in the current process is stored in the database; The communication message is sent to the target object according to the communication address.
2. The method according to claim 1, characterized in that The sending the communication message to the target object according to the communication address includes: Sending the communication message to a second message management process corresponding to the communication address of the target object through the first message management process; Among them, the second message management process is used to query the process where the target object is located from the mapping relationship maintained by the second message management process according to the object identifier, and send the communication message to the process so that the process routes the communication message to the target object; the mapping relationship includes the association relationship between the object identifier corresponding to the object running on the same electronic device as the second message management process and the process identifier corresponding to the process where the object is located.
3. The method according to claim 2, characterized in that The second message management process is further used to return the communication message to the first message management process when the second message management process fails to query the process where the target object is located; the method further includes: receiving, through the first message management process, the communication message returned by the second message management process; Through the first message management process, a new communication address is re-queried from the database according to the object identifier, and the communication message is sent to the target object according to the new communication address.
4. The method according to claim 2, characterized in that: The method further comprises: Receiving, through the first message management process, registration information sent by an object running on the same electronic device as the first message management process, wherein the registration information includes an object identifier of the object and a process identifier corresponding to the process in which the object is located; Through the first message management process, in response to the registration information, the communication address of the first message management process is used as the communication address of the object, the communication address of the object and the object identifier are stored in the database, and the mapping relationship between the object identifier and the process identifier is stored in the first message management process.
5. The method according to claim 1, characterized in that The acquiring of the communication message sent by the message sender to the target object comprises: Obtaining, through the first message management process, from the shared memory, a communication message sent by the message sender to the target object; The acquiring the communication address of the target object from a database according to the object identifier of the target object comprises: When the first message management process does not cache the communication address of the target object, the first message management process obtains the communication address of the target object from the database according to the object identifier of the target object, and caches the communication address in the first message management process.
6. The method according to any one of claims 1 to 5, characterized in that The sending the communication message to the target object according to the communication address includes: In the case that the target object and the message sender are in the same electronic device, the communication message is sent to the target object through a shared memory according to the communication address.
7. An object communication device, characterized in that: include: A first acquisition module is configured to acquire a communication message sent by a message sender to a target object, where the target object is an object running in a process; A second acquisition module is configured to acquire a communication address of the target object from a database according to the object identifier of the target object, wherein when the target object moves from one process to another, the communication address of the target object in the current process is stored in the database; The sending module is configured to send the communication message to the target object according to the communication address.
8. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processing device, the steps of the method according to any one of claims 1 to 6 are implemented.
9. An electronic device, characterized in that: include: a storage device having a computer program stored thereon; A processing device, configured to execute the computer program in the storage device to implement the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.