/// <summary> /// 创建一个适用于主动方的ALE Connection。 /// </summary> public AleConnectionClient(RsspEndPoint rsspEP, IEnumerable <RsspTcpLinkConfig> linkConfig, IAuMessageBuilder auMsgProvider, IAleConnectionObserver observer, IAleTunnelEventNotifier tcpEventNotifier) : base(rsspEP, auMsgProvider, observer, tcpEventNotifier) { linkConfig.ToList().ForEach(p => { var item = new AleClientTunnel(p.ClientIpAddress, p.ServerEndPoint, this); this.AddConnection(item); }); }
void IAleClientTunnelObserver.OnTcpConnecting(AleClientTunnel theConnection) { try { var args = new TcpConnectingEventArgs(theConnection.ID, this.RsspEP.LocalID, theConnection.LocalEndPoint, this.RsspEP.RemoteID, theConnection.RemoteEndPoint); this.TunnelEventNotifier.NotifyTcpConnecting(args); } catch (System.Exception ex) { LogUtility.Error(ex.ToString()); } }
void IAleClientTunnelObserver.OnTcpConnected(AleClientTunnel theConnection) { try { LogUtility.Info(string.Format("{0}: A TCP link Connected. LEP = {1}, REP = {2}", this.RsspEP.ID, theConnection.LocalEndPoint, theConnection.RemoteEndPoint)); lock (this.StateEventLock) { this.CurrentState.HandleTcpConnected(theConnection); } } catch (System.Exception ex) { LogUtility.Error(ex.ToString()); } }