Method for designing communication protocol between client and server

A technology of communication protocol and design method, which is applied in the field of communication, can solve the problems of poor flexibility, large protocol changes of new functions, and large space occupied by serialization of sticky package risks, etc., so as to reduce labor costs, improve communication efficiency, and avoid sticky packages risk effect

Inactive Publication Date: 2020-11-13
北京首汽智行科技有限公司
View PDF3 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0002] The current communication protocol between the client and the service has the defects of non-standard message format, inconvenient framework upgrade, major changes in the new function protocol, risk of sticky packets, and large space occupied by serialization, and each time an error code is added All need to change the program, the flexibility is poor, the labor cost is high and the communication efficiency is low

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0021] The present invention will be specifically introduced below in conjunction with specific embodiments.

[0022] The communication protocol design method between the client and the server provided by the embodiment of the present invention includes the following steps:

[0023] S101, divide the Reactor model into a master Reactor model and a slave Reactor model, wherein the master Reactor model is used to create a server socket and receive a connection request from the client according to the server socket and generate a socket connected to the client, and assign the socket to the slave Reactor model ; From the Reactor model, it is responsible for separating multiple connected sockets, reading and writing network data, and throwing tasks involving business processing functions to the worker thread pool for completion.

[0024] S102, using the IdleStateHandler heartbeat detection processor to design two heartbeat mechanisms.

[0025] As a specific embodiment of the presen...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses a method for designing a communication protocol between a client and a server. The method comprises the following steps: dividing a Reactor model into a master Reactor model and a slave Reactor model; designing two heartbeat mechanisms, and setting formats of data packets corresponding to the request message and the return message as a packet header, a module number, a command number, a length and data; using a Protol Buffers data serialization mechanism so as to serialize client information defined by a proto file and information to be transmitted; defining various action instructions of the functional module when the client communicates with the server in an annotation manner; finding an operator of the corresponding service according to the instruction identifierof the service module, managing an operator of each service via the scanner; defining the codes of the service type and the codes of the service errors, maintaining the codes of the service type andthe codes of the service errors in a dynamically configurable mode, and forming a communication protocol between the client and the server. Communication efficiency is improved, packet sticking risk is prevented, space is saved, flexibility is high, and labor cost is reduced.

Description

technical field [0001] The invention relates to the technical field of communication, in particular to a method for designing a communication protocol between a client and a server. Background technique [0002] The current communication protocol between the client and the service has the defects of non-standard message format, inconvenient framework upgrade, major changes in the new function protocol, risk of sticky packets, and large space occupied by serialization, and each time an error code is added All need to change the program, the flexibility is poor, the labor cost is high and the communication efficiency is low. Contents of the invention [0003] In order to solve the deficiencies of the prior art, the embodiment of the present invention provides a method for designing a communication protocol between a client and a server, the method comprising the following steps: [0004] Divide the Reactor model into the main Reactor model and the slave Reactor model, where...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Applications(China)
IPC IPC(8): H04L29/06
CPCH04L69/03H04L69/162H04L67/01
Inventor 谷冠飞
Owner 北京首汽智行科技有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products