Exemple #1
0
 /// <summary>
 /// 初始化
 /// </summary>
 Task ILifeFlow.Initialize()
 {
     if (TcpOption.Instance.Server == null || TcpOption.Instance.Server.Port <= 1024 || TcpOption.Instance.Server.Port >= short.MaxValue)
     {
         return(Task.CompletedTask);
     }
     MessagePoster.RegistPoster(this, TcpApp.ClientOptionService);
     logger         = DependencyHelper.LoggerFactory.CreateLogger <TcpServerFlow>();
     server         = SocketFactory.CreateTcpServer <TcpHandler>();
     handler        = server.Handler as TcpHandler;
     handler.Logger = logger;
     server.Options.DefaultListen.Port = TcpOption.Instance.Server.Port;
     server.Open();
     return(Task.CompletedTask);
 }