Пример #1
0
        static void NoCallbackTCPClient()
        {
            /* Verbose */
            EndpointAddress address = new EndpointAddress("net.tcp://localhost:1112/Milano");
            NetTcpBinding   binding = new NetTcpBinding();
            //WSHttpBinding binding = new WSHttpBinding();
            ChannelFactory <IDarPooling> channelFactory = new ChannelFactory <IDarPooling>(binding);
            IDarPooling client2 = channelFactory.CreateChannel(address);

            //Thread.Sleep(7000);
            Console.WriteLine("*****  Test TCP Client  (NO Callback) *****");
            Console.WriteLine("\n\nPress a key to start the communication");
            Console.ReadLine();

            //Console.WriteLine(client2.SayHello());
            Console.WriteLine("\n\n\nClient is now ready to perform some other task");
            Console.ReadLine();
        }
Пример #2
0
        public static void TestCommands(Command c)
        {
            string serviceNodeAddress = "http://localhost:1111/Catania";
            string callbackAddress    = "http://localhost:2222/prova";

            ClientCallback callback = new ClientCallback();

            // First of all, set up the connection
            EndpointAddress   endPointAddress = new EndpointAddress(serviceNodeAddress);
            WSDualHttpBinding binding         = new WSDualHttpBinding();

            binding.ClientBaseAddress = new Uri(callbackAddress);
            DuplexChannelFactory <IDarPooling> factory = new DuplexChannelFactory <IDarPooling>(
                callback, binding, endPointAddress);

            IDarPooling serviceProxy = factory.CreateChannel();

            serviceProxy.HandleDarPoolingRequest(c);
        }