public void Awake(NetworkProtocol protocol, string address) { try { IPEndPoint ipEndPoint; switch (protocol) { case NetworkProtocol.KCP: ipEndPoint = NetworkHelper.ToIPEndPoint(address); this.Service = new KService(ipEndPoint, (channel) => { this.OnAccept(channel); }) { Parent = this }; break; case NetworkProtocol.TCP: ipEndPoint = NetworkHelper.ToIPEndPoint(address); this.Service = new TService(ipEndPoint, (channel) => { this.OnAccept(channel); }) { Parent = this }; break; case NetworkProtocol.WebSocket: string[] prefixs = address.Split(';'); this.Service = new WService(prefixs, (channel) => { this.OnAccept(channel); }) { Parent = this }; break; } } catch (Exception e) { throw new Exception($"NetworkComponent Awake Error {address}", e); } }
public override AChannel ConnectChannel(string address) { IPEndPoint ipEndPoint2 = NetworkHelper.ToIPEndPoint(address); return(this.ConnectChannel(ipEndPoint2)); }