Esempio n. 1
0
        static void Main(string[] args)
        {
            var bootstrap = BootstrapFactory.CreateBootstrap();

            if (!bootstrap.Initialize())
            {
                LOGGER.Error("初始化失败!");
                Console.ReadKey();
                return;
            }
            if (bootstrap.Start() == SuperSocket.SocketBase.StartResult.Failed)
            {
                LOGGER.Error("协议解析器启动失败!");
                Console.ReadKey();
                return;
            }
            RainfallServer server = bootstrap.AppServers.SingleOrDefault(s => s.Name == "RainfallServer") as RainfallServer;

            if (server == null)
            {
                LOGGER.Error("协议解析器服务器未找到.");
                return;
            }
            LOGGER.Debug("输入任意键结束...");
            Console.ReadLine();
            bootstrap.Stop();
        }
        public virtual IReceiveFilter <TRequestInfo> CreateFilter(IAppServer appServer, IAppSession appSession,
                                                                  IPEndPoint remoteEndPoint)
        {
            //通过session获取服务实例.
            RainfallServer server = appSession.AppServer as RainfallServer;

            var filter = new RainfallReceiveFilterReserve(appSession);

            return(filter as IReceiveFilter <TRequestInfo>);
        }