コード例 #1
0
        public void TestReadDouble()
        {
            double target = -17.5;
            Task   server = Task.Run(() =>
            {
                pipe.WaitForConnection();
                Assert.AreEqual(target, protocol.ReadDouble());
            });

            using (Stream client = CreateClient())
            {
                PipeUtilities.SendDoubleToPipe(client, target);
            }

            server.Wait();
        }
コード例 #2
0
        public void TestReadDouble()
        {
            double target = -17.5;
            Task   server = Task.Run(() =>
            {
                pipe.WaitForConnection();
                Assert.AreEqual(target, protocol.ReadDouble());
            });
            Socket client = CreateClient();

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

            server.Wait();
        }