In industrial grade, the network communication protocol is usually designed to be divided into two layers: the higher layer and the lower layer.
[img]http://dl.iteye.com/upload/attachment/377461/d5e500ce-31c1-366f-899e-1cdc6b7f9ffe.jpg[/img]
The most outstanding difference is the higher packets employing a variable length while the lower doing a fixed length. The higher relates to business logic, whose packet length is ranging, say, from 1x KB to 1xx MB.
Why we need a fixed-size lower layer?
Imagine the following scenario: an emergency packet needs to be send immediately but a low-priority packet is in the process of being sent, which has occupied the expensive socket and would last for a while. Without the lower layer, we can do nothing but to wait.
It comes to a help that segmenting the size-variable packet into small fixed-size sub-packets, whereby we can check whether there’s an additional packet with higher priority at the interval of sending two sub-packets.
Abbreviations:
MUX – Multiplexing,
DEMUX - Demultiplexing
An alternate solution - FTP’s way:
FTP server and FTP client maintain two socket connections:
1) Command connection – for short and high-prioritized packets
2) Data connection – for long and low-prioritized packets
[img]http://dl.iteye.com/upload/attachment/377464/c4ed386c-2576-3f2d-9b9b-32424dd38216.jpg[/img]
[img]http://dl.iteye.com/upload/attachment/377461/d5e500ce-31c1-366f-899e-1cdc6b7f9ffe.jpg[/img]
The most outstanding difference is the higher packets employing a variable length while the lower doing a fixed length. The higher relates to business logic, whose packet length is ranging, say, from 1x KB to 1xx MB.
Why we need a fixed-size lower layer?
Imagine the following scenario: an emergency packet needs to be send immediately but a low-priority packet is in the process of being sent, which has occupied the expensive socket and would last for a while. Without the lower layer, we can do nothing but to wait.
It comes to a help that segmenting the size-variable packet into small fixed-size sub-packets, whereby we can check whether there’s an additional packet with higher priority at the interval of sending two sub-packets.
Abbreviations:
MUX – Multiplexing,
DEMUX - Demultiplexing
An alternate solution - FTP’s way:
FTP server and FTP client maintain two socket connections:
1) Command connection – for short and high-prioritized packets
2) Data connection – for long and low-prioritized packets
[img]http://dl.iteye.com/upload/attachment/377464/c4ed386c-2576-3f2d-9b9b-32424dd38216.jpg[/img]