Example #1
0
 public void InitConfig(ServerOption option)
 {
     m_Config = new ServerConfig
     {
         Port = option.Port,
         Ip   = "Any",
         MaxConnectionNumber = option.MaxConnectionNumber,
         Mode = SocketMode.Tcp,
         Name = option.Name
     };
 }
Example #2
0
        public MainServer(IHostApplicationLifetime appLifetime, IOptions <ServerOption> serverConfig, ILogger <MainServer> logger)
            : base(new DefaultReceiveFilterFactory <ReceiveFilter, EFBinaryRequestInfo>())
        {
            ServerOpt   = serverConfig.Value;
            AppLogger   = logger;
            AppLifetime = appLifetime;

            NewSessionConnected += new SessionHandler <NetworkSession>(OnConnected);
            SessionClosed       += new SessionHandler <NetworkSession, CloseReason>(OnClosed);
            NewRequestReceived  += new RequestHandler <NetworkSession, EFBinaryRequestInfo>(RequestReceived);
        }