예제 #1
0
        public static void Main(string[] args)
        {
            GrpcEnvironment.SetLogger(new ConsoleLogger());
            const int Port        = 5000;
            var       weatherImpl = new WeatherImpl(new WeatherService());
            var       userImpl    = new UserImpl(new UserService());
            var       pingImpl    = new PingImpl();
            Server    server      = new Server
            {
                Services =
                {
                    Weathers.BindService(weatherImpl).Intercept(new AuthInterceptor()),
                    Check.BindService(pingImpl),
                    Users.BindService(userImpl)
                },
                Ports = { new ServerPort("0.0.0.0", Port, ServerCredentials.Insecure) }
            };

            server.Start();
            GrpcEnvironment.Logger.Info("[START] Tozawa server listening on port " + Port);
            GrpcEnvironment.Logger.Info("[Other] Press any key to stop the server...");

            Console.Read();

            server.ShutdownAsync().Wait();
        }
    public static void Main(string[] args)
    {
        try
        {
        IiopChannel channel = new IiopChannel(0);
        ChannelServices.RegisterChannel(channel, false);

        CorbaInit init = CorbaInit.GetInit();
        NamingContext nc = (NamingContext)RemotingServices.Connect(
            typeof(NamingContext), args[0]);
        PingImpl pingable = new PingImpl();
        nc.rebind(new NameComponent[] {
            new NameComponent("test"),
            new NameComponent("ExamplePing")
        }, pingable);
        Thread.Sleep(Timeout.Infinite);
        }
        catch (Exception e)
        {
        Console.WriteLine(e);
        }
    }