Пример #1
0
        static void Main(string[] args)
        {
            LogAction.LogOut += LogAction_LogOut;

            CloudServer tmp = new CloudServer(1024 * 1024);//没个SocketAsync对象缓冲区128k,最大能接收1M长度的数据包

            tmp.Install(typeof(PackHandler));
            tmp.Start();
            while (true)
            {
                Console.ReadLine();
            }
        }
Пример #2
0
        public void Start(bool isLog)
        {
            void SetLog(ILoggerFactory log)
            {
                if (isLog)
                {
                    log.AddConsole(LogLevel.Trace);
                }
            };

            cloudServer = new ServBuilder().ConfigureLogSet(null, SetLog).ConfigureServHostAndPort(p => p.Port = 9557).ConfigureBufferSize(p => p.MaxPackSize = 8 * 1024 * 1024).Bulid();
            cloudServer.Install(typeof(ServerPackHandler));
            cloudServer.Start();
        }
Пример #3
0
        static void Main(string[] args)
        {
            LogAction.LogOut += LogAction_LogOut;
            CloudServer tmp = new CloudServer("any", 2285, 1000, 1024 * 128, 1024 * 1024);//没个SocketAsync对象缓冲区128k,最大能接收1M长度的数据包

            tmp.Install(typeof(PackHandler));
            tmp.Start();
            while (true)
            {
                string msg = Console.ReadLine();

                foreach (var item in PackHandler.UserList)
                {
                    item.token.Get <IClientPacker>().Message(msg);
                }
            }
        }
Пример #4
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;
            LogAction.LogOut      += LogAction_LogOut;
            CloudServer tmp = new CloudServer("any", 2285, 1000, 1024 * 128, 1024 * 1024);//没个SocketAsync对象缓冲区128k,最大能接收1M长度的数据包

            tmp.Install(typeof(PackHandler));
            tmp.Start();
            while (true)
            {
                string msg = Console.ReadLine();

                foreach (var item in PackHandler.UserList)
                {
                    item.token.CV(3001, msg);
                }
            }
        }