예제 #1
0
        static void Main(string[] args)
        {
            string address = "net.pipe://localhost/gorillacoding/IPCTest";

            NetNamedPipeBinding binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
            EndpointAddress     ep      = new EndpointAddress(address);
            ITestContract       channel = ChannelFactory <ITestContract> .CreateChannel(binding, ep);

            // TODO: Check connected.

            Console.WriteLine("Client Connected");

            Console.WriteLine(" 2 + 2 = {0}", channel.Add(2, 2));
            Console.WriteLine(" 256 - 89 = {0}", channel.Subtract(256, 89));

            Console.ReadLine();
        }
예제 #2
0
        // Program.cs
        static void Main(string[] args)
        {
            string address = "net.pipe://localhost/selector/12345";

            NetNamedPipeBinding binding         = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
            EndpointAddress     ep              = new EndpointAddress(address);
            CallbackHandler     callbackHandler = new CallbackHandler();
            ITestContract       channel         = DuplexChannelFactory <ITestContract> .CreateChannel(callbackHandler, binding, ep);

            Console.WriteLine("Client Connected");

            Console.WriteLine(" 2 + 2 = ");
            channel.Add(2, 2);
            Console.WriteLine(" 256 - 89 =");
            channel.Subtract(256, 89);

            Console.ReadLine();
        }