コード例 #1
0
        static void StartServer()
        {
            ServerOptions serverOptions = ServerOptions.CreateDefault();

            serverOptions.Hosts[0].Port = 48050;

            ServerBuilder builder = new ServerBuilder();

            builder.LoadFromFile("options.json");

            builder.AddAuthenticator(new ClientAuthenticator());
            builder.AddAuthorization(new Authorization());
            builder.AddDefaultDeliveryHandler(new DeliveryHandler());
            builder.AddDefaultChannelHandler(new ChannelHandler());
            builder.AddDefaultChannelAuthenticator(new ChannelAuthenticator());

            TwinoServer twinoServer = new TwinoServer(serverOptions);

            MqServer server = builder.CreateServer();

            twinoServer.UseMqServer(server);
            twinoServer.Start();

            Console.WriteLine("Server started");
            _server = server;
        }
コード例 #2
0
        public void Start(int pingInterval = 3, int requestTimeout = 4)
        {
            ServerOptions serverOptions = ServerOptions.CreateDefault();

            serverOptions.Hosts[0].Port  = Port;
            serverOptions.PingInterval   = pingInterval;
            serverOptions.RequestTimeout = requestTimeout;

            TwinoServer server = new TwinoServer(serverOptions);

            server.UseMqServer(Server);
            server.Start();
        }