Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            var endPoint = ProtocolEndPointBase.CreateEndPoint("tcp://127.0.0.1:6900");

            _client = new TestClientImplementation();
            _serviceClient = ServiceClientBuilder.CreateClient<ITestServerService>(endPoint, _client);
            _serviceClient.Connected += ClientOnConnected;
            _serviceClient.Disconnected += ClientOnDisconnected;
            _serviceClient.Connect();

            do {
                var cmd = Console.ReadLine();
                if (cmd == "exit") {
                    _serviceClient.Disconnect();
                }
                if (cmd == "void") {
                    _serviceClient.ServiceProxy.RemoteVoid();
                }
                if (cmd == "magic") {
                    var poco = new SimplePoco {Id = 1, Title = "My POCO obj"};
                    _serviceClient.ServiceProxy.SomeRemoteMagic(poco);
                }
                if (cmd == "ex") {
                    _serviceClient.ServiceProxy.RaiseTheException();
                }
            } while (_serviceClient.CommunicationState == CommunicationStates.Connected);

            Console.WriteLine("Press any key to exit.");
            Console.Read();
        }
Ejemplo n.º 2
0
        public static void Main(string[] args)
        {
            var serverConfiguration = Factory.Create<Provider>("conf/client.xml");
            var dynamicConfig = serverConfiguration.FirstAsExpando().configuration;

            string address = string.Format("tcp://{0}:{1}", dynamicConfig.zeus.host, dynamicConfig.zeus.port);
            var endPoint = ProtocolEndPointBase.CreateEndPoint(address);

            _service = ServiceClientBuilder.CreateClient<IClientService>(endPoint);
            _service.Connected += (o, a) => Console.WriteLine("Connection to auth-server successfull!");
            _service.Disconnected += (o, a) => Console.WriteLine("Connection to inter-server lost.");
            _service.ConnectTimeout = 30;
            _service.Connect();

            do {

                var cmd = Console.ReadLine();
                if (cmd == "exit") {
                    _service.Disconnect();
                }
                if (cmd == "login") {
                    var account = _service.ServiceProxy.ClientLogin("test", "test");
                    Console.WriteLine("Got account info: {0}", account);
                }
                if (cmd == "servers") {
                    var servers = _service.ServiceProxy.GetServerDescriptions();
                    Console.WriteLine("Got server info:");
                    servers.ToList().ForEach(s => Console.WriteLine("\t{0}", s));
                }

            } while (_service.CommunicationState == CommunicationStates.Connected);

            Console.WriteLine("Press any key to exit.");
            Console.Read();
        }
Ejemplo n.º 3
0
        public override void Load()
        {
            IAsyncServiceClient asyncServiceClient = _serviceClientFactory.GetAsyncServiceClient();

            _client = asyncServiceClient ?? _serviceClientFactory.GetServiceClient();

            _client.Connect(_connectionConfiguration);

            base.Load();
        }
 public IActionResult GetConnect()
 {
     try
     {
         //"http://46.98.190.16:5001"
         //"http://192.168.88.33:5001"
         serviceClient.Connect("http://194.107.230.233:5001");
         return(Ok());
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Ejemplo n.º 5
0
        public void AutoDiscoverSourceServiceEndpoints(SourceInformationCollection allSourceInformation, Uri configurationServiceEndpoint, ICredentialHandler credentialHandler)
        {
            this.serviceClientFactory.CredentialHandler = credentialHandler;
            if (configurationServiceEndpoint != null && configurationServiceEndpoint.IsAbsoluteUri && configurationServiceEndpoint.Scheme == Uri.UriSchemeHttps)
            {
                if (this.IsStopRequested)
                {
                    Tracer.TraceInformation("SourceDataProviderManager.CreateServiceClients: Stop requested when trying to auto discover with configuration service server", new object[0]);
                    return;
                }
                Uri autoDiscoverUrl = new Uri(configurationServiceEndpoint.GetLeftPart(UriPartial.Authority) + "/autodiscover/autodiscover.svc");
                this.AutoDiscoverServiceEndpoints((from sourceInformation in allSourceInformation.Values
                                                   where this.IsServiceEndpointNeededForSource(sourceInformation)
                                                   select sourceInformation).ToList <SourceInformation>(), autoDiscoverUrl, 0);
                if (this.IsStopRequested)
                {
                    Tracer.TraceInformation("SourceDataProviderManager.CreateServiceClients: Stop requested when trying to auto discover with configuration service endpoint", new object[0]);
                    return;
                }
                using (IServiceClient <ISourceDataProvider> serviceClient = this.serviceClientFactory.CreateSourceDataProvider(configurationServiceEndpoint, this.abortTokenForTasks))
                {
                    if (serviceClient.Connect())
                    {
                        SourceDataProviderManager.VerifyAndSetServiceEndpoint((from sourceInformation in allSourceInformation.Values
                                                                               where this.IsServiceEndpointNeededForSource(sourceInformation)
                                                                               select sourceInformation).ToList <SourceInformation>(), serviceClient);
                    }
                }
            }
            IEnumerable <IGrouping <string, SourceInformation> > enumerable = from sourceInformation in allSourceInformation.Values
                                                                              where this.IsServiceEndpointNeededForSource(sourceInformation)
                                                                              group sourceInformation by SourceDataProviderManager.GetDomainFromSmtpEmailAddress(sourceInformation.Configuration.Id.StartsWith("\\")?sourceInformation.Configuration.Name : sourceInformation.Configuration.Id);

            foreach (IGrouping <string, SourceInformation> grouping in enumerable)
            {
                if (this.IsStopRequested)
                {
                    Tracer.TraceInformation("SourceDataProviderManager.CreateServiceClients: Stop requested when trying to auto discover with email domains of source mailboxes.", new object[0]);
                    return;
                }
                this.AutoDiscoverServiceEndpointsWithEmailDomain(grouping.ToList <SourceInformation>(), grouping.Key.ToLowerInvariant());
            }
            SourceInformation sourceInformation2 = allSourceInformation.Values.FirstOrDefault((SourceInformation sourceInformation) => this.IsServiceEndpointNeededForSource(sourceInformation));

            if (sourceInformation2 != null && !this.IsStopRequested)
            {
                throw new ExportException(ExportErrorType.FailedToAutoDiscoverExchangeWebServiceUrl, sourceInformation2.Configuration.Id);
            }
        }
Ejemplo n.º 6
0
        public static void Main(string[] args)
        {
            var endPoint = ProtocolEndPointBase.CreateEndPoint("tcp://127.0.0.1:6900");

            _client                      = new TestClientImplementation();
            _serviceClient               = ServiceClientBuilder.CreateClient <ITestServerService>(endPoint, _client);
            _serviceClient.Connected    += ClientOnConnected;
            _serviceClient.Disconnected += ClientOnDisconnected;
            _serviceClient.Connect();

            do
            {
                var cmd = Console.ReadLine();
                if (cmd == "exit")
                {
                    _serviceClient.Disconnect();
                }
                if (cmd == "void")
                {
                    _serviceClient.ServiceProxy.RemoteVoid();
                }
                if (cmd == "magic")
                {
                    var poco = new SimplePoco {
                        Id = 1, Title = "My POCO obj"
                    };
                    _serviceClient.ServiceProxy.SomeRemoteMagic(poco);
                }
                if (cmd == "ex")
                {
                    _serviceClient.ServiceProxy.RaiseTheException();
                }
            } while (_serviceClient.CommunicationState == CommunicationStates.Connected);


            Console.WriteLine("Press any key to exit.");
            Console.Read();
        }
Ejemplo n.º 7
0
        public static void Main(string[] args)
        {
            var serverConfiguration = Factory.Create <Provider>("conf/client.xml");
            var dynamicConfig       = serverConfiguration.FirstAsExpando().configuration;

            string address  = string.Format("tcp://{0}:{1}", dynamicConfig.zeus.host, dynamicConfig.zeus.port);
            var    endPoint = ProtocolEndPointBase.CreateEndPoint(address);

            _service                = ServiceClientBuilder.CreateClient <IClientService>(endPoint);
            _service.Connected     += (o, a) => Console.WriteLine("Connection to auth-server successfull!");
            _service.Disconnected  += (o, a) => Console.WriteLine("Connection to inter-server lost.");
            _service.ConnectTimeout = 30;
            _service.Connect();

            do
            {
                var cmd = Console.ReadLine();
                if (cmd == "exit")
                {
                    _service.Disconnect();
                }
                if (cmd == "login")
                {
                    var account = _service.ServiceProxy.ClientLogin("test", "test");
                    Console.WriteLine("Got account info: {0}", account);
                }
                if (cmd == "servers")
                {
                    var servers = _service.ServiceProxy.GetServerDescriptions();
                    Console.WriteLine("Got server info:");
                    servers.ToList().ForEach(s => Console.WriteLine("\t{0}", s));
                }
            } while (_service.CommunicationState == CommunicationStates.Connected);

            Console.WriteLine("Press any key to exit.");
            Console.Read();
        }
Ejemplo n.º 8
0
        private async void Enter()
        {
            Busy = true;

            _client = _serviceClientFactory.GetServiceClient();

            var configuration = new ConnectionConfiguration
            {
                ServerName = ServerName,
                UseSsl     = UseSsl
            };

            _client.Connect(configuration);

            SignInResult result = await _client.SignInAsync(Name);

            Busy = false;

            ChatViewModel chatViewModel = result.Success
                ? new ChatViewModel(_client)
                : null;

            OnEntered(new SignInEventArgs(result, chatViewModel));
        }
Ejemplo n.º 9
0
        public static void Main(string[] args)
        {
            // Try access a config
            var serverConfiguration = Factory.Create<Provider>("conf/server.xml");
            var dynamicConfig = serverConfiguration.FirstAsExpando().configuration;

            // Prepare console for a large output
            #if WINDOWS
            var width = Math.Min(100, Console.LargestWindowWidth - 2);
            Console.CursorVisible = false;
            Console.Clear();
            Console.WindowLeft = Console.WindowTop = 0;
            if (Console.WindowWidth < width) {
                Console.WindowWidth = width;
            }
            #endif

            var ver = Assembly.GetExecutingAssembly().GetName().Version;
            Console.Title = string.Format("Zeus auth-server v{0}.{1}", ver.Major, ver.Minor);

            ServerConsole.StatusLine(Console.Title);

            // Create inter-server listener service
            string interServerEndPointAddress = string.Format("tcp://{0}:{1}", dynamicConfig.network.inter_server.host, dynamicConfig.network.inter_server.port);
            var interServerEndPoint = ProtocolEndPointBase.CreateEndPoint(interServerEndPointAddress);

            ServerConsole.Info("Start connecting to inter-server..");
            // @TODO: Is any action coming from inter-server to auth-server?
            // @TODO: Create inter -> auth service (character goes back to char select)
            _interClient = ServiceClientBuilder.CreateClient<IAuthService>(interServerEndPoint, new ServerServiceImplementation());
            _interClient.Connected += (o, a) => {
                ServerConsole.WriteLine(ServerConsoleColor.Status, " successfull!");
                // AuthServerLogin
                _interClient.ServiceProxy.AuthServerLogin((string)dynamicConfig.network.inter_server.password);
            };
            _interClient.Disconnected += delegate {
                ServerConsole.ErrorLine("Connection to inter-server lost.");
                // @TODO: Reconnect?
            };
            _interClient.ConnectTimeout = 30;
            _interClient.Connect();

            // Create a client listener service
            string endPointAddress = string.Format("tcp://{0}:{1}", dynamicConfig.network.host, dynamicConfig.network.port);
            _clientService = ServiceBuilder.CreateService(ProtocolEndPointBase.CreateEndPoint(endPointAddress));
            _clientService.ClientConnected += (sender, clientEventArgs) => ServerConsole.DebugLine("Client connected #{0}", clientEventArgs.Client.ClientId);
            _clientService.ClientDisconnected += (sender, clientEventArgs) => ServerConsole.DebugLine("Client disconnected #{0}", clientEventArgs.Client.ClientId);
            // Add interface for client connections
            var clientService = new ClientServiceImplementation(_interClient.ServiceProxy);
            _clientService.AddService<IClientService, ClientServiceImplementation>(clientService);
            // Start listener service
            _clientService.Start();

            ServerConsole.StatusLine("Auth-server is listening to: {0}", endPointAddress);

            do {

                var cmd = Console.ReadLine();
                if (cmd == "exit") {
                    _clientService.Stop();
                }

            } while (_clientService.Connected);

            ServerConsole.WarningLine("Press any key to exit.");
            Console.Read();
        }
Ejemplo n.º 10
0
        public static void Main(string[] args)
        {
            // Try access a config
            var serverConfiguration = Factory.Create <Provider>("conf/server.xml");
            var dynamicConfig       = serverConfiguration.FirstAsExpando().configuration;

            // Prepare console for a large output
#if WINDOWS
            var width = Math.Min(100, Console.LargestWindowWidth - 2);
            Console.CursorVisible = false;
            Console.Clear();
            Console.WindowLeft = Console.WindowTop = 0;
            if (Console.WindowWidth < width)
            {
                Console.WindowWidth = width;
            }
#endif

            var ver = Assembly.GetExecutingAssembly().GetName().Version;
            Console.Title = string.Format("Zeus auth-server v{0}.{1}", ver.Major, ver.Minor);

            ServerConsole.StatusLine(Console.Title);

            // Create inter-server listener service
            string interServerEndPointAddress = string.Format("tcp://{0}:{1}", dynamicConfig.network.inter_server.host, dynamicConfig.network.inter_server.port);
            var    interServerEndPoint        = ProtocolEndPointBase.CreateEndPoint(interServerEndPointAddress);

            ServerConsole.Info("Start connecting to inter-server..");
            // @TODO: Is any action coming from inter-server to auth-server?
            // @TODO: Create inter -> auth service (character goes back to char select)
            _interClient            = ServiceClientBuilder.CreateClient <IAuthService>(interServerEndPoint, new ServerServiceImplementation());
            _interClient.Connected += (o, a) => {
                ServerConsole.WriteLine(ServerConsoleColor.Status, " successfull!");
                // AuthServerLogin
                _interClient.ServiceProxy.AuthServerLogin((string)dynamicConfig.network.inter_server.password);
            };
            _interClient.Disconnected += delegate {
                ServerConsole.ErrorLine("Connection to inter-server lost.");
                // @TODO: Reconnect?
            };
            _interClient.ConnectTimeout = 30;
            _interClient.Connect();

            // Create a client listener service
            string endPointAddress = string.Format("tcp://{0}:{1}", dynamicConfig.network.host, dynamicConfig.network.port);
            _clientService = ServiceBuilder.CreateService(ProtocolEndPointBase.CreateEndPoint(endPointAddress));
            _clientService.ClientConnected    += (sender, clientEventArgs) => ServerConsole.DebugLine("Client connected #{0}", clientEventArgs.Client.ClientId);
            _clientService.ClientDisconnected += (sender, clientEventArgs) => ServerConsole.DebugLine("Client disconnected #{0}", clientEventArgs.Client.ClientId);
            // Add interface for client connections
            var clientService = new ClientServiceImplementation(_interClient.ServiceProxy);
            _clientService.AddService <IClientService, ClientServiceImplementation>(clientService);
            // Start listener service
            _clientService.Start();

            ServerConsole.StatusLine("Auth-server is listening to: {0}", endPointAddress);

            do
            {
                var cmd = Console.ReadLine();
                if (cmd == "exit")
                {
                    _clientService.Stop();
                }
            } while (_clientService.Connected);

            ServerConsole.WarningLine("Press any key to exit.");
            Console.Read();
        }