示例#1
0
文件: Exec.cs 项目: tlsnns/NTLMClient
        private void AAAA()
        {
            while (IsRun)
            {
                try
                {
                    byte[] buff = ci.Read(12);
                    if (buff.Length != 12)
                    {
                        throw new Exception("Pipe Read Length Error");
                    }
                    ulong transportHeader = BitConverter.ToUInt64(buff, 0);
                    if (transportHeader != 0x1122334455667788u)
                    {
                        throw new Exception("Pipe Read TransportHeader Error");
                    }
                    uint transportLength = BitConverter.ToUInt32(buff, 8);

                    buff = ci.Read(transportLength);
                    if (buff.Length != transportLength)
                    {
                        throw new Exception("Pipe Read TransportLength Error");
                    }
                    var str = Encoding.UTF8.GetString(buff, 1, buff.Length - 1);
                    if (buff[0] == 1)
                    {
                        Console.Write(str);
                    }
                    else
                    {
                        Console.Write("Server failure:" + str);
                    }
                }
                catch { }
            }
            ci.Close();
        }
示例#2
0
        public void TestPipeIO()
        {
            PipeClient client;
            Thread     thread;
            string     value;

            client = new PipeClient();

            thread = new Thread(() => OpenPipeServer("PipeTest"));
            thread.Start();

            client.Connect("PipeTest");

            client.Write("1");
            value = client.Read();

            Assert.AreEqual(1, Int32.Parse(value), "Pipe communication failed.");

            client.Close();
        }
示例#3
0
 public override byte[] ReceiveDatas()
 {
     return(PC.Read(8192));
 }