public void TestReadInt()
        {
            int  target = 1234;
            Task server = Task.Run(() =>
            {
                pipe.WaitForConnection();
                Assert.AreEqual(target, protocol.ReadInt());
            });

            using (NamedPipeClientStream client = CreateClient())
            {
                PipeUtilities.SendIntToPipe(client, target);
            }

            server.Wait();
        }
Example #2
0
        public void TestReadInt()
        {
            int  target = 1234;
            Task server = Task.Run(() =>
            {
                pipe.WaitForConnection();
                Assert.AreEqual(target, protocol.ReadInt());
            });
            Socket client = CreateClient();

            byte[] buf = BitConverter.GetBytes(target);
            client.Send(BitConverter.GetBytes(buf.Length).Take(4).ToArray());
            // sock.Send(new byte[4] { 0xD2, 4, 0, 0 });
            client.Send(buf);
            client.Disconnect(false);

            server.Wait();
        }