protected override void OnReceive(StreamBuffer buffer) { Packet packet = new Packet(buffer); AegisTask.Run(() => { packet.SkipHeader(); switch (packet.PID) { case 0x01: OnHello(packet); break; case 0x03: OnEcho_Res(packet); break; } }); }
private void Echo_Res(Packet packet) { Packet reqPacket = new Packet(Protocol.Echo_Req); reqPacket.Write(_tempBuffer, 0, FormMain.BufferSize); SendPacket(reqPacket, (buffer) => { return Packet.GetPacketId(buffer.Buffer) == Protocol.Echo_Res; }, (result) => { packet.SkipHeader(); Echo_Res(new Packet(result.Buffer)); } ); }
protected override void OnReceive(StreamBuffer buffer) { Counter_ReceiveCount.Add(1); Counter_ReceiveBytes.Add(buffer.WrittenBytes); Packet packet = new Packet(buffer); AegisTask.Run(() => { packet.SkipHeader(); switch (packet.PID) { case 0x02: OnEcho_Req(packet); break; } }); }