Esempio n. 1
0
        public async Task Run(string listenAddress, string listenToken)
        {
            try
            {
                CalculatorHandler    handler   = new CalculatorHandler();
                Calculator.Processor processor = new Calculator.Processor(handler);

                TServerTransport serverTransport = new RelayListenerServerTransport(
                    new RelayListener(listenAddress,
                                      TokenProvider.CreateSharedAccessSignatureTokenProvider(listenToken),
                                      RelayAddressType.Configured));

                TServer server = new TSimpleServer(processor, serverTransport);

                // Use this for a multithreaded server
                // server = new TThreadPoolServer(processor, serverTransport);

                Console.WriteLine("Starting the server...");
                server.Serve();
            }
            catch (Exception x)
            {
                Console.WriteLine(x.StackTrace);
            }
            Console.WriteLine("done.");
        }
        public async Task Run(string listenAddress, string listenToken)
        {
            try
            {
                CalculatorHandler handler = new CalculatorHandler();
                Calculator.Processor processor = new Calculator.Processor(handler);

                TServerTransport serverTransport = new RelayListenerServerTransport(
                   new RelayListener(listenAddress,
                    TokenProvider.CreateSharedAccessSignatureTokenProvider(listenToken),
                    RelayAddressType.Configured));

                TServer server = new TSimpleServer(processor, serverTransport);

                // Use this for a multithreaded server
                // server = new TThreadPoolServer(processor, serverTransport);

                Console.WriteLine("Starting the server...");
                server.Serve();
            }
            catch (Exception x)
            {
                Console.WriteLine(x.StackTrace);
            }
            Console.WriteLine("done.");
        }