コード例 #1
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;


            var tmp = new ServBuilder()
                      .ConfigureDefaults()
                      .ConfigureServHostAndPort(p => p.Port = 2285)
                      .ConfigureLogSet(() => new LoggerFactory(), log => log.AddConsole(LogLevel.Trace))
                      .Bulid();

            tmp.Install(typeof(PackHandler1).Assembly);
            tmp.Start();
            tmp.IsCheckReadTimeOut = false;



            while (true)
            {
                string msg = Console.ReadLine();

                foreach (var item in PackHandler1.UserList)
                {
                    item.Token.Action(3001, msg);
                }
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            CloudServer tmp = new ServBuilder().ConfigureDefaults().ConfigureServHostAndPort(p => p.Port = 3775).Bulid();

            tmp.Install(typeof(PackHandler));
            tmp.Start();
            while (true)
            {
                Console.ReadLine();
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: lanicon/ZYNet
        static void Main(string[] args)
        {
            //8 添加一个 Server 基本和 client类似

            var server = new ServBuilder().ConfigureServHostAndPort(p => p.Port = 777).Bulid(); //我们绑定本地IP地址和端口777

            server.Install(typeof(HelloWorldController));                                       // 安装HelloWorldController以供服务client

            //你也可以这样写
            //server.Install(typeof(HelloWorldController).Assembly);
            //这样的好处在于你有多个Controller你不需要一一注册了,只要它们处于同一个程序集

            server.Start(); //最后调用start()让服务器启动

            Console.ReadKey();
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: lanicon/ZYNet
        static void Main(string[] args)
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;


            var tmp = new ServBuilder()
                      .ConfigureDefaults()
                      .ConfigureBufferSize(p => p.MaxPackSize = 1024 * 256)
                      .ConfigureServHostAndPort(p => p.Port   = 2285)
                      .Bulid();

            tmp.Install(typeof(PackHandler));
            tmp.Start();

            while (true)
            {
                string msg = Console.ReadLine();

                foreach (var item in PackHandler.UserList)
                {
                    item.Token.Action(3001, msg);
                }
            }
        }