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); } }
protected AChannel(AService service, ChannelType channelType) { this.ChannelType = channelType; this.service = service; }