public void WriteStream(object o) { _serde.Pack(_sendbuf, o); _sendbuf.Seek(0, SeekOrigin.Begin); _sendbuf.CopyTo(_stream); // DumpWriteStream(); // because if there is remained buffer size ( == sz), // it is not sure that SetLength(sz) keep remained buffer, // only when buffer is fully written to network, we reduce length. if (_sendbuf.Position == _sendbuf.Length) { _sendbuf.SetLength(0); } }
private static byte[] GetPostHighScoreCommand(int highScore) { MsgPack.BoxingPacker packer = new MsgPack.BoxingPacker(); byte[] result = packer.Pack(new object[] { 0, highScore }); return(result); }
private static byte[] GetCurrentHighScoreCommand() { MsgPack.BoxingPacker packer = new MsgPack.BoxingPacker(); byte[] result = packer.Pack(new object[] { 1 }); return(result); }