/
ConnectWare Network Layer

ConnectWare Network Layer

The network layer provides message fragmentation, reassembly, and retries. The standard and maximum size of a network layer message payload is 1000 bytes. Under some configuration scenarios and where conserving RAM is critical, the size of the network layer message payload may be reduced to 500 bytes. Network layer messages are always valid JSON strings including the NULL terminator. The contents of the JSON strings will encode commands and data for processing by the upper protocol layers.

Network Frame

The Network Layer frame is structured as follows:

Field

FRAG_NUM

FRAG_TOT

PAYLOAD

Byte Size

1

1

0-1000

Value

0-4

1-5

Valid JSON String with NULL terminator

Fragment Number

FRAG_NUM is the number of the current fragment, zero indexed. It is always less than FRAG_TOT.

Fragment Total

FRAG_TOT is the total number of fragments of the Network Layer message.

Payload

PAYLOAD is a valid JSON string with NULL termination.

Example Network Layer frame:

\x00\x01{"cmd":"wr","id":47932,"name":"value","crc":"1234"}\x00

Fragmentation and Reassembly

When preparing a message to be sent to a peer, the network layer will determine if it can fit into a single Data Link Layer frame. If it can then it will be sent in its entirety as a single frame. Otherwise, the Network Layer will send the first fragment using the maximum Data Link Layer payload size. After the first fragment is ACKed the Network Layer will send the second fragment, and so on until all the fragments are delivered to the receiver. Only the last fragment of a message will use less than the maximum Data Link Layer payload size.

The receiver side must have a buffer large enough to reassemble the network payload before sending the message to the upper layers for processing.  Receivers will only process fragments in order. Any out of order fragments will reset the receiver’s reassembly logic.

Timeouts and Retries

The Network Layer relies on the timeouts of the Data Link Layer. When a timeout occurs the Network Layer will retransmit the same fragment up to 3 times. If the message is still not delivered successfully then the upper layer is notified that a timeout occurred.

 

Related content

ConnectWare Data Link Layer
ConnectWare Data Link Layer
More like this
OpenKitchen ConnectWare Serial Protocol Specification
OpenKitchen ConnectWare Serial Protocol Specification
More like this
ConnectWare Library (CWL) Task
ConnectWare Library (CWL) Task
More like this
ConnectWare Header Information
ConnectWare Header Information
More like this
Brownfield Legacy Network Interfaces
Brownfield Legacy Network Interfaces
More like this