说明
Udp的适配器,主要承担组包和解析数据。其基本逻辑和Tcp相似。但是需要注意的是,Udp适配器是多线程操作。在解析数据时,应当充分考虑并发问题。
class MyUdpAdatper : UdpDataHandlingAdapter{public override bool CanSplicingSend => false;protected override void PreviewReceived(EndPoint remoteEndPoint, ByteBlock byteBlock){}protected override void PreviewSend(EndPoint endPoint, byte[] buffer, int offset, int length, bool isAsync){}protected override void PreviewSend(EndPoint endPoint, IList<TransferByte> transferBytes, bool isAsync){}protected override void Reset(){}}
单元测试
使用UdpDataAdapterTester即可测试。
