Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            XmlConnector.Path = args.Length == 0 ? Directory.GetCurrentDirectory() : args[0];

            var transaqConnectorImpl = new TransaqConnectorImpl();
            var server = new Server
            {
                Services = { TransaqConnector.BindService(transaqConnectorImpl) },
                Ports    = { new ServerPort("0.0.0.0", Port, ServerCredentials.Insecure) }
            };

            XmlConnector.Init(str =>
            {
                transaqConnectorImpl.OnMsg(str);
                return(str);
            });

            server.Start();

            Console.WriteLine("Greeter server listening on port " + Port);
            Console.WriteLine("Press any key to stop the server...");
            Console.ReadKey();

            server.ShutdownAsync().Wait();
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            XmlConnector.Path = args.Length == 0 ? Directory.GetCurrentDirectory() : args[0];

            var cacert         = File.ReadAllText(@"/keys/ca.crt");
            var servercert     = File.ReadAllText(@"/keys/server.crt");
            var serverkey      = File.ReadAllText(@"/keys/server.key");
            var keypair        = new KeyCertificatePair(servercert, serverkey);
            var sslCredentials = new SslServerCredentials(new List <KeyCertificatePair>()
            {
                keypair
            }, cacert, false);


            var transaqConnectorImpl = new TransaqConnectorImpl();
            var server = new Server
            {
                Services = { TransaqConnector.BindService(transaqConnectorImpl) },
                Ports    = { new ServerPort("0.0.0.0", Port, sslCredentials) }
            };

            XmlConnector.Init(str =>
            {
                transaqConnectorImpl.OnMsg(str);
                return(str);
            });

            server.Start();

            Console.WriteLine("Greeter server listening on port " + Port);
            Console.WriteLine("Press any key to stop the server...");
            Console.ReadKey();

            server.ShutdownAsync().Wait();
        }