Example #1
0
        public GrpcRemoteSetup()
        {
            const string target  = "192.168.31.23:8080";
            const string localIP = "192.168.31.2";

            loginService  = GrpcConnectionExtension.GetLoginService(target);
            clientBuilder = new ClientBuilder().UseGrpc(target, localIP, 0);
        }
Example #2
0
 internal void Setup()
 {
     LoggerFactory = new LoggerFactory();
     LoggerFactory.AddNLog().ConfigureNLog(NlogConfigFile);
     Logger    = LoggerFactory.CreateLogger("Chat.Client.Console");
     Cmdlogger = LoggerFactory.CreateLogger("Chat.Client.Console.Commands");
     GrpcConnectionExtension.SetLogger(LoggerFactory);
     Builder = new ClientBuilder()
               .UseLoggerFactory(LoggerFactory)
               .UseGrpc(copt.ServerAddress, copt.Host, copt.Port);
 }
Example #3
0
        public GrpcLocalSetup()
        {
            const string host   = "localhost";
            var          port   = new Random().Next(5000, 10000);
            var          target = $"{host}:{port}";

            var serverBuilder = new ServerBuilder().UseGrpc(host, port).UseInMemory();

            clientBuilder = new ClientBuilder().UseGrpc(target, "localhost", 0);
            loginService  = GrpcConnectionExtension.GetLoginService(target);
            server        = serverBuilder.Build();
        }
Example #4
0
        internal override void Execute(Program app)
        {
            var lf = new LoggerFactory();

            lf.AddNLog().ConfigureNLog(Program.NlogConfigFile);
            app._logger    = lf.CreateLogger("Chat.Server.Console");
            app._cmdlogger = lf.CreateLogger("Chat.Server.Console.Commands");
            GrpcConnectionExtension.SetLogger(lf);

            app.consoleOption = this;
            var builder = new ServerBuilder()
                          .UseLoggerFactory(lf)
                          .UseGrpc(Host, Port);

            if (Database == DbType.InMemory)
            {
                builder.UseInMemory();
            }
            else if (Database == DbType.SQLite)
            {
                builder.UseSQLite(SQLiteString);
            }
            app.server = builder.Build();
        }