Request/Response Communication请求/响应通信

One of the most common communication patterns is the request/ response pattern. One communication partner (in the following called the client) sends a request message, which is answered by another communication partner (the server).
最常见的通信模式之一是请求/响应模式。 客户端发送请求消息,服务器端应答。

Client

  • Construct the payload
  • Set the Message ID based on the method the client wants to call
  • Set the Length field
  • Optionally set the Request ID to a unique number
  • Set the Protocol Version according
  • Set the Interface Version according to the interface definition
  • Set the Message Type to Request (i.e. 0x00)
  • Set the Return Code to 0x00

Server

  • builds it header based on the header of the client ,and in addition
  • Construct the payload
  • Set the length to the 8 Bytes + new payload size
  • Set the Message Type to RESPONSE (i.e. 0x80) or ERROR (i.e. 0x81)
  • Set the Return Code

Mapping
For the response and error message the IP addresses and port number of the transport protocol shall match the request message.
对于Response和Error message,传输层的IP Address和Port口需要和Request message匹配

The transport protocol (TCP or UDP) stays the same.
传输层协议TCP或UDP保持不变

新锦江官网