/// <summary> /// 服务端绑定端口 /// </summary> /// <param name="protocol"></param> /// <param name="ipEndPoint"></param> public void Awake(NetworkProtocol protocol, IPEndPoint ipEndPoint) { try { switch (protocol) { case NetworkProtocol.TCP: this.service = new TService(ipEndPoint); break; case NetworkProtocol.KCP: this.service = new KService(ipEndPoint); break; default: throw new ArgumentOutOfRangeException(); } this.StartAccept(); } catch (Exception e) { throw new Exception($"{ipEndPoint}", e); } }
protected AChannel(AService service) { this.Id = IdGenerater.GenerateId32(); this.service = service; }