示例#1
0
        static void DoSelfIO(StreamIO io)
        {
            var block = new byte[Program.BLOCK_SIZE];
            var len   = 0;

            while ((len = io.Input.Read(block, 0, Program.BLOCK_SIZE)) != 0)
            {
                io.Output.Write(block, 0, len);
                io.Output.Flush();
            }
        }
示例#2
0
        static void DoChildIO(StreamIO io)
        {
            Task.Run(() =>
            {
                var writeBlock = new byte[Program.BLOCK_SIZE];
                var writeLen   = 0;
                while ((writeLen = io.ChildOutput.Read(writeBlock, 0, Program.BLOCK_SIZE)) != 0)
                {
                    io.Output.Write(writeBlock, 0, writeLen);
                    io.Output.Flush();
                }
            });
            var readBlock = new byte[Program.BLOCK_SIZE];
            var readLen   = 0;

            while ((readLen = io.Input.Read(readBlock, 0, Program.BLOCK_SIZE)) != 0)
            {
                io.ChildInput.Write(readBlock, 0, readLen);
                io.ChildInput.Flush();
            }
        }