why we need a bi-layer protocol

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]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值