public IU3dNetChannel RegisterNetChannel(string channelId, NetServiceType serviceType, Action <IU3dNetChannel> onConnect, Action <IU3dNetChannel> onReConnect, Action <IU3dNetChannel> onDisConnect, Action <IU3dNetChannel> onClose) { if (ChannelDic.ContainsKey(channelId)) { return(ChannelDic[channelId]); } else { switch (serviceType) { case NetServiceType.Socket: var socketChannel = new U3dNetChannelOriginSocket(); socketChannel.OnConnect(onConnect); socketChannel.OnReconnect(onReConnect); socketChannel.OnDisconnect(onDisConnect); socketChannel.OnClose(onClose); return(socketChannel); default: return(null); } } }
public WcpService(string httpPrefixed, Session session, Network network, NetServiceType serviceType) : base(session, network) { this.HttpPrefixed = httpPrefixed; this.ServiceType = serviceType; this.ProtocalType = ProtocalType.Wcp; }
/// <summary> /// 构造函数 /// </summary> /// <param name="pEvent">事件</param> public AsyncService(NetServiceType eNetService, SocketEvent pEvent) { this._eNetService = eNetService; this._pSocketEvent = pEvent; this.iMaxClient = 1000; }
/// <summary> /// 构造函数 /// </summary> /// <param name="endPoint"></param> /// <param name="session"></param> public KcpService(IPEndPoint endPoint, Session session, NetServiceType serviceType) : base(session) { this.serviceType = serviceType; this.endPoint = endPoint; }
private NetService(NetServiceType type, in NetEndPoint localEndPoint, in NetEndPoint remoteEndPoint, string?path, NetServiceState state, int iNode)
/// <summary> /// 构造函数 /// </summary> /// <param name="endPoint">Ip/端口</param> /// <param name="session">会话类</param> /// <param name="network">网络类</param> /// <param name="serviceType">通讯服务类型</param> public TcpService(IPEndPoint endPoint, Session session, Network network, NetServiceType serviceType) : base(session, network) { this.ServiceType = serviceType; this.EndPoint = endPoint; this.ProtocalType = ProtocalType.Tcp; }