A Host and Mini communication method, device, equipment and storage medium

By using the serialization and deserialization characteristics of Google Protocol Buffer in Host and Mini communication, a fast sticky method is designed to solve the problem of cross-machine communication bandwidth waste and deployment cost, and improve system response speed and security.

CN114979304BActive Publication Date: 2024-09-17AUTOMOTIVE INTELLIGENCE & CONTROL OF CHINA CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210560759.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-20
Publication Date
2024-09-17
Estimated Expiration
2042-05-20

AI Technical Summary

Technical Problem

Cross-machine communication between the existing Host and Mini results in wasted bandwidth and increased time and resource costs when deploying third-party libraries.

Method used

Use the serialization and deserialization features of Google Protocol Buffer to design a fast sticky method. By creating sockets, connecting to the server, detecting message queues, message dequeue processing, format conversion and serialization to send messages, only upgrading the communication library The underlying implementation maintains the consistency of the user-facing interface.

Benefits of technology

It effectively improves system response speed, application applicability and system security, and solves the problems of bandwidth waste and deployment cost.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114979304B
    Figure CN114979304B
Patent Text Reader

Abstract

The present invention discloses a Host and Mini communication method, device, equipment and storage medium, wherein the method comprises: creating a socket and initializing the socket; connecting to a server according to the socket and judging whether to exit the communication; when judging not to exit the communication, detecting whether a queue of messages to be sent is empty; when detecting that the queue of messages to be sent is not empty, dequeuing messages in the queue of messages to be sent; format conversion and serialization of messages that have completed the dequeuing process, and sending them to the server. The present invention designs a fast sticking method by utilizing the serialization and deserialization characteristics of Google Protocol Buffer, only upgrading the underlying implementation of the communication library, maintaining the consistency of the user-oriented interface, so that users do not need to change the existing code, and effectively improve the system response speed, application applicability and system security.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a Host and Mini communication method, device, equipment and storage medium. Background Art

[0002] In the process of conceiving and implementing this application, the inventor of this application found that the cross-machine communication between Host and mini in the prior art would lead to time costs in deploying and learning other third-party libraries. For example, in the underlying communication implementation of ICVOS0.5, a fixed transmission and fixed reception solution implemented by a system-generated API was adopted, that is, transmission according to a fixed length L and reception according to a fixed length L. When the data sent by the user is less than the length L, the remaining length is filled; when the transmission exceeds the length L, the user is prompted that the transmission failed. When the transmission volume of each data item fluctuates greatly relative to the length L, bandwidth is extremely wasted.

[0003] The preceding description is intended to provide general background information and does not necessarily constitute prior art. Summary of the invention

[0004] The technical problem to be solved by the embodiments of the present invention is to provide a Host and Mini communication method, device, equipment and storage medium, which can solve the current problem of extreme waste of bandwidth in cross-machine communication between Host and Mini, as well as the problem of increased time cost and resources when deploying and learning third-party libraries.

[0005] To solve the above problem, a first aspect of an embodiment of the present application provides a Host and Mini communication method, which at least includes the following steps:

[0006] Create a socket and initialize the socket;

[0007] Connecting to the server according to the socket and determining whether to exit the communication;

[0008] When it is determined that the communication is not to be exited, whether the queue of messages to be sent is empty is detected;

[0009] When it is detected that the queue of messages to be sent is not empty, dequeueing the messages in the queue of messages to be sent;

[0010] The message that has completed the message dequeue processing is format converted and serialized, and sent to the server.

[0011] In a possible implementation manner of the first aspect, after the sending to the server, the method further includes:

[0012] Check again whether the queue of messages to be sent is empty;

[0013] When it is detected that the queue of messages to be sent is not empty, dequeueing the messages in the queue of messages to be sent;

[0014] The message that has completed the message dequeue processing is format converted and serialized, and sent to the server.

[0015] In a possible implementation manner of the first aspect, the method further includes:

[0016] When it is determined to exit the communication, the socket is closed to end the communication.

[0017] In a possible implementation manner of the first aspect, after creating a socket and initializing the socket, the method further includes:

[0018] Bind the socket and monitor the socket.

[0019] In a possible implementation manner of the first aspect, after connecting to the server according to the socket and determining whether to exit communication, the method further includes:

[0020] Initializing a first buffer of the server;

[0021] When it is determined that the communication is not to be exited, the socket is polled through the server, and data is read into a second buffer;

[0022] Determine whether the data in the second buffer has been traversed byte by byte;

[0023] If so, exit the communication;

[0024] If not, bytes are appended to the first buffer and the data in the first buffer is deserialized.

[0025] In a possible implementation manner of the first aspect, after deserializing the data in the first buffer, the method further includes:

[0026] Determine whether the deserialization is successful;

[0027] If yes, call the user callback information and clear the first buffer;

[0028] If not, it is determined again whether the data in the second buffer has been traversed byte by byte.

[0029] In a possible implementation manner of the first aspect, after determining again whether the data in the second buffer has been traversed byte by byte, the method further includes:

[0030] When it is determined that the data in the second buffer has not been traversed byte by byte, bytes are appended to the first buffer, and the data in the first buffer is deserialized again;

[0031] It is determined again whether the deserialization is successful.

[0032] Accordingly, a second aspect of an embodiment of the present application provides a Host and Mini communication device, including:

[0033] A socket module, used for creating a socket and initializing the socket;

[0034] A connection module, used to connect to the server according to the socket and determine whether to exit the communication;

[0035] The message queue module is used to detect whether the queue of messages to be sent is empty when it is determined that the communication is not to be exited;

[0036] A message dequeue module, used for dequeueing messages in the message queue to be sent when it is detected that the message queue to be sent is not empty;

[0037] The communication module is used to convert and serialize the message after the message dequeue processing is completed, and send it to the server.

[0038] The third aspect of the embodiments of the present application further proposes a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of any one of the above-mentioned Host and Mini communication methods are implemented.

[0039] The fourth aspect of the embodiments of the present application further proposes a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the Host and Mini communication method described in any one of the above items are implemented.

[0040] Implementing the embodiments of the present invention has the following beneficial effects:

[0041] The embodiment of the present invention provides a Host and Mini communication method, device, equipment and storage medium, the method comprising: creating a socket and initializing the socket; connecting to a server according to the socket and determining whether to exit communication; when determining not to exit communication, detecting whether the queue of messages to be sent is empty; when detecting that the queue of messages to be sent is not empty, dequeuing the messages in the queue of messages to be sent; formatting and serializing the messages that have completed the dequeuing, and sending them to the server. The embodiment of the present invention designs a fast sticking method by utilizing the serialization and deserialization characteristics of Google Protocol Buffer, only upgrading the underlying implementation of the communication library, maintaining the consistency of the user-oriented interface, so that users do not need to change the existing code, and effectively improves the system response speed, application applicability and system security. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 A flow chart of a Host and Mini communication method according to an embodiment of the present application;

[0043] Figure 2 This is a flow chart of a method for implementing a communication between Host and Mini based on a client according to an embodiment of the present application;

[0044] Figure 3 This is a flow chart of a method for implementing a communication between Host and Mini based on a server according to an embodiment of the present application;

[0045] Figure 4 This is a schematic block diagram of the structure of a Host and Mini communication device according to an embodiment of the present application;

[0046] Figure 5 A schematic block diagram of the structure of a computer device according to an embodiment of the present application.

[0047] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0048] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0049] In the description of this application, it should be understood that the terms "first", "second", etc. are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first", "second", etc. may explicitly or implicitly include one or more of the feature. In the description of this application, unless otherwise specified, "plurality" means two or more.

[0050] The embodiments of the present application can be applied to a server. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0051] First, the application scenarios that the present invention can provide are introduced, such as providing a Host and Mini communication method, device, equipment and storage medium, which can utilize the serialization and deserialization characteristics of Google Protocol Buffer, design a fast packet sticking method, and realize Host and Mini communication.

[0052] The first embodiment of the present invention:

[0053] See also Figure 1 .

[0054] like Figure 1 As shown, this embodiment provides a Host and Mini communication method, which at least includes the following steps:

[0055] S1, creating a socket and initializing the socket;

[0056] S2, connecting to the server according to the socket, and determining whether to exit the communication;

[0057] S3. When it is determined that the communication is not to be exited, detecting whether the queue of messages to be sent is empty;

[0058] S4. When it is detected that the queue of messages to be sent is not empty, dequeue the messages in the queue of messages to be sent;

[0059] S5. Perform format conversion and serialization on the message that has completed the message dequeue processing, and send it to the server.

[0060] In the prior art, cross-machine communication between Host and mini will result in a lot of extra time and resource costs when deploying and learning other third-party libraries. For example, in the underlying communication implementation of ICVOS version 0.5, a fixed transmission and fixed reception solution implemented by the system-generated API is adopted, that is, transmission is performed according to a fixed length L, and reception is performed according to a fixed length L. When the data sent by the user is less than the length L, the remaining length is filled; when the transmission exceeds the length L, the user is prompted that the transmission failed. When the transmission amount of each data item fluctuates greatly relative to the length L, bandwidth is extremely wasted. In order to solve the above technical problems, the embodiment of the present application utilizes the serialization and deserialization characteristics of Google Protocol Buffer, and designs a fast packet sticking method to realize the communication between Host and Mini. It only relies on upgrading the underlying implementation of the communication library, and still maintains the consistency of the user-oriented interface, so that users do not need to modify the existing code, thereby improving the applicability of the application and the response speed of the system.

[0061] Specifically, for step S1, first a socket is created on the client, and the created socket is initialized. A socket is an endpoint of communication, and each socket consists of an IP address and a port number. Each pair of processes communicating over the network needs to use a pair of sockets, that is, each process has one. Usually, the socket adopts a client-server architecture. The server waits for client requests by listening to a specified port. After receiving the request, the server accepts the connection from the client socket, thereby completing the connection.

[0062] For step S2, the server is connected mainly according to the initialized socket, and it is determined whether to disconnect and exit the communication according to user needs.

[0063] Regarding step S3, when it is determined that the communication does not need to be terminated and the communication needs to be continued, it is detected whether the queue of messages to be sent is empty.

[0064] For step S4, when it is detected that the current message queue to be sent is not empty, that is, there are several message data in the message queue, message dequeue processing is performed on the several message data in the current message queue to be sent, and the messages are dequeued one by one. Among them, the message dequeue logic depends on the type of the message queue.

[0065] For step S5, the message data of the completed message dequeue is format converted and serialized in turn, the message data is converted into a pb string and then serialized, and the serialized pb string is sent to the server connected according to the socket, so as to achieve cross-machine communication between Host and Mini.

[0066] In a preferred embodiment, after sending to the server, the method further comprises:

[0067] Check again whether the queue of messages to be sent is empty;

[0068] When it is detected that the queue of messages to be sent is not empty, dequeueing the messages in the queue of messages to be sent;

[0069] The message that has completed the message dequeue processing is format converted and serialized, and sent to the server.

[0070] In a specific embodiment, after step S5, the following process is also included: re-detecting whether the current message queue to be sent is empty, judging whether all the message data in the message queue to be sent has been sent, and if it is detected that the message data in the current message queue to be sent has not been sent, it is necessary to perform message dequeue processing on the message in the message queue to be sent again; performing format conversion and serialization on the message that has completed the message dequeue processing, and sending it to the server. The above process is repeated until all the message data in the current message queue to be sent is cleared, and the communication is completed.

[0071] In a preferred embodiment, it also includes:

[0072] When it is determined to exit the communication, the socket is closed to end the communication.

[0073] In a specific embodiment, the Host and Mini communication method of this embodiment further includes: when it is determined that communication needs to be exited according to a user instruction, closing the created socket and ending the communication.

[0074] In a preferred embodiment, after creating a socket and initializing the socket, the method further includes:

[0075] Bind the socket and monitor the socket.

[0076] In a specific embodiment, after step S1, the process further includes binding the created socket that is initialized, and monitoring the bound socket in real time.

[0077] In a preferred embodiment, after connecting to the server according to the socket and determining whether to exit the communication, the method further includes:

[0078] Initializing a first buffer of the server;

[0079] When it is determined that the communication is not to be exited, the socket is polled through the server, and data is read into a second buffer;

[0080] Determine whether the data in the second buffer has been traversed byte by byte;

[0081] If so, exit the communication;

[0082] If not, bytes are appended to the first buffer and the data in the first buffer is deserialized.

[0083] In a specific embodiment, after step S2, the first buffer of the connected server is initialized, and all data in the first buffer is cleared; when it is determined that the communication is not currently exited, the message is dequeued, the received socket is polled through the server, and the corresponding data is read into the second buffer. It is determined whether the data in the second buffer has been traversed byte by byte, and if so, the communication is exited; if not, bytes need to be appended to the first buffer, and the data in the first buffer after the bytes are appended is deserialized.

[0084] In a preferred embodiment, after deserializing the data in the first buffer, the method further includes:

[0085] Determine whether the deserialization is successful;

[0086] If yes, call the user callback information and clear the first buffer;

[0087] If not, it is determined again whether the data in the second buffer has been traversed byte by byte.

[0088] In a specific embodiment, when deserializing the data in the first buffer after the byte appending, it is also determined whether this round of deserialization is successful. If it is determined to be successful, the user callback information is called and the first buffer is cleared; if it is determined to be unsuccessful, it is determined again whether the data in the second buffer has been traversed byte by byte. The above process is repeated until it is determined that this round of deserialization is completely successful.

[0089] In a preferred embodiment, after determining again whether the data in the second buffer has been traversed byte by byte, the method further includes:

[0090] When it is determined that the data in the second buffer has not been traversed byte by byte, bytes are appended to the first buffer, and the data in the first buffer is deserialized again;

[0091] It is determined again whether the deserialization is successful.

[0092] In a specific embodiment, when determining again whether the data in the second buffer has been traversed byte by byte, if it is determined that the data in the second buffer has not been traversed byte by byte, the communication is exited; if it is determined that the data in the second buffer has not been traversed byte by byte, bytes are appended to the first buffer, and the data in the first buffer is deserialized again; and it is determined again whether the deserialization is successful. The above process is repeated until the data in the second buffer has been traversed byte by byte.

[0093] The present embodiment provides a method for communication between Host and Mini, including: creating a socket and initializing the socket; connecting to a server according to the socket and determining whether to exit communication; when determining not to exit communication, detecting whether the queue of messages to be sent is empty; when detecting that the queue of messages to be sent is not empty, dequeuing the messages in the queue of messages to be sent; format conversion and serialization of the messages that have completed the dequeuing process, and sending them to the server. The present embodiment designs a fast sticking method by utilizing the serialization and deserialization characteristics of Google Protocol Buffer to realize communication between Hos and Mini, and only upgrades the underlying implementation of the communication library to maintain the consistency of the user-oriented interface, so that users do not need to change the existing code, solves the problem of extreme waste of bandwidth in cross-machine communication between Host and Mini in the prior art, and the increase of time cost and resources when deploying and learning third-party libraries, and effectively improves the system response speed, application applicability and system security.

[0094] The second embodiment of the present invention:

[0095] See also Figure 2 .

[0096] like Figure 2 As shown, this embodiment also provides a method for implementing Host and Mini communication based on the client, which is executed on the client, and the specific process includes: first creating a socket, and then initializing the socket; connecting to the server, and determining whether to exit this connection or communication; if so, closing the socket and ending this communication; if not, detecting whether the queue of messages to be sent is empty; if so, waiting for instructions and exiting this communication; if not, dequeuing the message, converting it into a pb string, then serializing it, and finally sending the message; after sending the message, returning to the step of detecting whether the queue of messages to be sent is empty again, and repeating the above process until the queue of messages to be sent is empty, and exiting this communication.

[0097] The third embodiment of the present invention:

[0098] See also Figure 3 .

[0099] like Figure 3As shown, this embodiment also provides a flow chart of a method for implementing a communication between Host and Mini based on the server side, which is executed on the server side, and the specific process includes: creating a socket; binding a socket; listening to the socket; waiting for the client to connect; initializing the buffer to be empty; judging whether to exit this communication; if so, directly closing the socket and ending this communication; if not, polling the socket and reading data into buffer A; detecting whether buffer A has been traversed word by word, if so, exiting this communication; if not. Then appending the bytes of buffer B and deserializing the data of buffer B; judging whether the deserialization is successful, if so, calling the user callback, clearing buffer B, and then returning to the step of detecting whether buffer A has been traversed word by word, and looping this step until buffer A has been traversed word by word, and exiting the communication; if not, directly returning to the step of detecting whether buffer A has been traversed word by word, until the deserialization is successful.

[0100] The fourth embodiment of the present invention:

[0101] See also Figure 4 .

[0102] like Figure 4 As shown, this embodiment provides a Host and Mini communication device, including:

[0103] The socket module 100 is used to create a socket and initialize the socket.

[0104] Specifically, for the socket module 100, a socket is first created on the client, and the created socket is initialized. A socket is an endpoint of communication, and each socket consists of an IP address and a port number. Each pair of processes communicating over the network needs to use a pair of sockets, that is, each process has one. Usually, the socket adopts a client-server architecture. The server waits for client requests by listening to a specified port. After receiving the request, the server accepts the connection from the client socket, thereby completing the connection.

[0105] The connection module 200 is used to connect to the server according to the socket and determine whether to exit the communication.

[0106] Specifically, the connection module 200 mainly connects to the server according to the initialized socket, and determines whether to disconnect and exit the communication according to user needs.

[0107] The message queue module 300 is used to detect whether the queue of messages to be sent is empty when it is determined not to exit the communication.

[0108] Specifically, for the message queue module 300, when it is determined that the communication does not need to be exited and the communication needs to be continued, it is detected whether the current queue of messages to be sent is empty.

[0109] The message dequeue module 400 is used to dequeue the messages in the message queue when it is detected that the message queue to be sent is not empty.

[0110] Specifically, for the message dequeue module 400, when it is detected that the current message queue to be sent is not empty, that is, when there are several message data in the message queue, message dequeue processing is performed on the several message data in the current message queue to be sent, and the messages are dequeued one by one. Among them, the message dequeue logic depends on the type of the message queue.

[0111] The communication module 500 is used to convert and serialize the message that has completed the message dequeue processing, and send it to the server.

[0112] Specifically, for the communication module 500, the message data that has completed the message dequeue is format converted and serialized in turn, the message data is converted into a pb string and then serialized, and the serialized pb string is sent to the server connected according to the socket, so as to perform cross-machine communication between the Host and the Mini.

[0113] This embodiment creates a socket through a socket module and initializes the socket; connects to a server according to the socket through a connection module and determines whether to exit communication; detects whether the message queue to be sent is empty through a message queue module when it is determined that the communication is not exited; performs message dequeue processing on the message in the message queue to be sent when the message dequeue module detects that the message queue to be sent is not empty; and performs format conversion and serialization on the message that has completed the message dequeue processing through a communication module, and sends it to the server. This embodiment designs a fast sticky packet method by utilizing the serialization and deserialization characteristics of Google Protocol Buffer to realize communication between Hos and Mini, and only upgrades the underlying implementation of the communication library to maintain the consistency of the user-oriented interface, so that users do not need to change the existing code, solves the problem of extreme waste of bandwidth in cross-machine communication between Host and Mini in the prior art, and the increase of time cost and resources when deploying and learning third-party libraries, and effectively improves system response speed, application applicability and system security.

[0114] Reference Figure 5 In an embodiment of the present application, a computer device is also provided. The computer device may be a server, and its internal structure may be as follows: Figure 3As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor designed by the computer is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as the Host and Mini communication method. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a Host and Mini communication method is implemented. The Host and Mini communication method includes: creating a socket and initializing the socket; connecting to a server according to the socket, and determining whether to exit the communication; when it is determined that the communication is not exited, detecting whether the queue of messages to be sent is empty; when it is detected that the queue of messages to be sent is not empty, performing message dequeue processing on the messages in the queue of messages to be sent; format conversion and serialization of the messages that have completed the message dequeue processing, and sending them to the server.

[0115] An embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, a Host and Mini communication method is implemented, including the steps of: creating a socket and initializing the socket; connecting to a server according to the socket, and determining whether to exit communication; when determining not to exit communication, detecting whether a queue of messages to be sent is empty; when detecting that the queue of messages to be sent is not empty, dequeuing messages in the queue of messages to be sent; formatting and serializing messages for which dequeuing is completed, and sending them to the server.

[0116] The Host and Mini communication method executed above, this embodiment designs a fast sticky packet method by utilizing the serialization and deserialization characteristics of Google Protocol Buffer to realize the communication between Host and Mini, and only upgrades the underlying implementation of the communication library to maintain the consistency of the user-oriented interface, so that users do not need to change the existing code, thereby solving the problem of extreme waste of bandwidth in cross-machine communication between Host and Mini in the prior art, as well as the increase in time cost and resources when deploying and learning third-party libraries, and effectively improving the system response speed, application applicability and system security.

[0117] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0118] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the modules can be a logical function division. There may be other division methods in actual implementation. For example, multiple modules or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, units or modules, which can be electrical or other forms.

[0119] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.

[0120] In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of software functional modules.

[0121] The above is a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several improvements and modifications without departing from the principle of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.

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

Claims

1. A Host and Mini communication method, It is characterized in that At least the following steps are included: Create a socket and initialize the socket; Connecting to the server according to the socket and determining whether to exit the communication; Initializing a first buffer of the server; When it is determined that the communication is not to be exited, the socket is polled through the server, and data is read into a second buffer; Determine whether the data in the second buffer has been traversed byte by byte; If so, exit the communication; If not, append bytes to the first buffer and deserialize the data in the first buffer; When it is determined that the communication is not to be exited, whether the queue of messages to be sent is empty is detected; When it is detected that the queue of messages to be sent is not empty, dequeueing the messages in the queue of messages to be sent; The message that has completed the message dequeue processing is format converted and serialized, and sent to the server.

2. The Host and Mini communication method according to claim 1, It is characterized in that After sending to the server, the method further includes: Check again whether the queue of messages to be sent is empty; When it is detected that the queue of messages to be sent is not empty, dequeueing the messages in the queue of messages to be sent; The message that has completed the message dequeue processing is format converted and serialized, and sent to the server.

3. The Host and Mini communication method according to claim 1, It is characterized in that Also includes: When it is determined to exit the communication, the socket is closed to end the communication.

4. The Host and Mini communication method according to claim 1, It is characterized in that After creating the socket and initializing the socket, the method further includes: Bind the socket and monitor the socket.

5. The Host and Mini communication method according to claim 1, It is characterized in that After deserializing the data in the first buffer, the method further includes: Determine whether the deserialization is successful; If yes, call the user callback information and clear the first buffer; If not, it is determined again whether the data in the second buffer has been traversed byte by byte.

6. The Host and Mini communication method according to claim 5, It is characterized in that After determining again whether the data in the second buffer has been traversed byte by byte, the method further includes: When it is determined that the data in the second buffer has not been traversed byte by byte, bytes are appended to the first buffer, and the data in the first buffer is deserialized again; It is determined again whether the deserialization is successful.

7. A Host and Mini communication device, It is characterized in that include: A socket module, used for creating a socket and initializing the socket; A connection module, used to connect to the server according to the socket and determine whether to exit the communication; The message queue module is used to detect whether the queue of messages to be sent is empty when it is determined that the communication is not to be exited; A message dequeue module, used for dequeueing messages in the message queue to be sent when it is detected that the message queue to be sent is not empty; A communication module, used for format conversion and serialization of messages that have completed message dequeue processing, and sending them to the server; The device is also used to: initialize the first buffer of the server; when it is determined not to exit the communication, poll the socket through the server and read data into the second buffer; determine whether the data in the second buffer has been traversed byte by byte; if so, exit the communication; if not, append bytes to the first buffer and deserialize the data in the first buffer.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of the Host and Mini communication method described in any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the Host and Mini communication method described in any one of claims 1 to 6 are implemented.