public void TestInputNullData() { var packer = new FramePacker(); Exception ex; var data = packer.Input(null, out ex); Assert.AreEqual(0, data); }
public void InputTests() { var packer = new FramePacker(); Exception ex; var length = packer.Input(Arr.Merge(BitConverter.GetBytes(14), Encoding.Default.GetBytes("helloworld")), out ex); Assert.AreEqual(14, length); }
void Update() { if (connector != null && connector.Connected) { LoginC2S msg = new LoginC2S(); msg.name = "huashao"; byte[] dd = ProtobufTool.ProtoBufToBytes <LoginC2S>(msg); for (int i = 0; i < 10; i++) { packer.Input((ushort)DemoTypeCmd.LoginReq, dd); Debug.LogError("sendSize:" + packer.CurSize); var await = connector.Send(packer.SendBuf, 0, packer.CurSize); packer.Clear(); } } }