Example #1
0
        private void SetEncodings()
        {
            // We use a stack here.  The least favored encoding is pushed onto the stack first.
            Stack stack = new Stack();

            stack.Push(RfbEncoding.Raw);
            stack.Push(RfbEncoding.CopyRect);
            stack.Push(RfbEncoding.Rre);

            // We do support CoRRE encoding.
            // However, Ultra-VNC server is broken.
            // If we use CoRRE and server-side scaling is enabled, the server will
            // send us frame buffer updates with number of rectangles set incorrectly.
            // So the morale of the story is not to use CoRRE. If we know the server
            // does not scale the buffer, then we can enable CoRRE.
            // But this can all be avoided by using Hextile.
            //stack.Push(RfbEncoding.CoRre);

            stack.Push(RfbEncoding.Hex);

            stack.Push(RfbEncoding.NewFBSize);

            byte[] msg;
            msg = RfbProtoUtil.GetSetEncodingsMsgHdr((UInt16)stack.Count);
            WriteBytes(msg, RfbCliMsgType.SetEncodings);
            RfbEncoding[] encodings = new RfbEncoding[stack.Count];
            stack.ToArray().CopyTo(encodings, 0);
            msg = RfbProtoUtil.GetSetEncodingsMsg(encodings);
            WriteBytes(msg);
        }