Пример #1
0
        /// <summary>
        /// 지정된 NetworkChannel만을 생성하고 네트워킹을 시작합니다.
        /// </summary>
        /// <param name="networkChannelName">시작할 NetworkChannel 이름</param>
        /// <returns>해당 NetworkChannel 객체</returns>
        public static NetworkChannel StartNetwork(String networkChannelName)
        {
            ConfigNetworkChannel config = _listNetworkConfig.Find(v => v.NetworkChannelName == networkChannelName);

            if (config == null)
            {
                throw new AegisException(AegisResult.InvalidArgument, "Invalid NetworkChannel name({0}).", networkChannelName);
            }


            NetworkChannel channel = NetworkChannel.CreateChannel(config.NetworkChannelName);

            if (config.ListenIpAddress.Length == 0 || config.ListenPortNo == 0)
            {
                channel.StartNetwork(
                    delegate { return(GenerateSession(config.SessionClassName)); },
                    config.InitSessionPoolCount, config.MaxSessionPoolCount);
            }
            else
            {
                channel.StartNetwork(
                    delegate { return(GenerateSession(config.SessionClassName)); },
                    config.InitSessionPoolCount, config.MaxSessionPoolCount)
                .OpenListener(config.ListenIpAddress, config.ListenPortNo);
            }

            return(channel);
        }
Пример #2
0
 /// <summary>
 /// NetworkChannel을 생성하고 네트워킹을 시작합니다.
 /// </summary>
 public static void StartNetwork()
 {
     foreach (ConfigNetworkChannel config in _listNetworkConfig)
     {
         NetworkChannel channel = NetworkChannel.CreateChannel(config.NetworkChannelName);
         if (config.ListenPortNo == 0)
         {
             channel.StartNetwork(
                 delegate { return(GenerateSession(config.SessionClassName)); },
                 config.InitSessionPoolCount, config.MaxSessionPoolCount);
         }
         else
         {
             channel.StartNetwork(
                 delegate { return(GenerateSession(config.SessionClassName)); },
                 config.InitSessionPoolCount, config.MaxSessionPoolCount)
             .OpenListener(config.ListenIpAddress, config.ListenPortNo);
         }
     }
 }