Example #1
0
        public void Awake(NetworkProtocol protocol, IPEndPoint ipEndPoint)
        {
            try
            {
                switch (protocol)
                {
                case NetworkProtocol.KCP:
                    this.Service = new KService(ipEndPoint);
                    break;

                case NetworkProtocol.TCP:
                    this.Service = new TService(ipEndPoint);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                this.Service.AcceptCallback += this.OnAccept;

                this.Start();
            }
            catch (Exception e)
            {
                throw new Exception($"{ipEndPoint}", e);
            }
        }
Example #2
0
 protected AChannel(AService service, ChannelType channelType)
 {
     this.ChannelType = channelType;
     this.service     = service;
 }