Exemplo n.º 1
0
        public override void HandleTcpConnected(AleClientTunnel theConnection)
        {
            // TCP连接成功后发送CR。
            this.SendConnectionRequestFrame(theConnection);

            // 通知观察器TCP连接已建立。
            var args = new TcpConnectedEventArgs(theConnection.ID,
                                                 this.Context.RsspEP.LocalID, theConnection.LocalEndPoint,
                                                 this.Context.RsspEP.RemoteID, theConnection.RemoteEndPoint);

            this.Context.TunnelEventNotifier.NotifyTcpConnected(args);

            // 启动超时检测计时器。
            theConnection.StartHandshakeTimer();
        }
Exemplo n.º 2
0
        protected void SendConnectionRequestFrame(AleClientTunnel theConnection)
        {
            var au1Packet = this.Context.AuMsgBuilder.BuildAu1Packet();

            var crData = new AleConnectionRequest(this.Context.RsspEP.LocalID, this.Context.RsspEP.RemoteID,
                                                  this.Context.RsspEP.ServiceType, au1Packet);

            // 构建AleFrame。
            ushort seqNo   = 0;
            var    appType = this.Context.RsspEP.ApplicatinType;
            var    crFrame = new AleFrame(appType, seqNo, theConnection.IsNormal, crData);

            // 发送。
            var bytes = crFrame.GetBytes();

            theConnection.Send(bytes);

            LogUtility.Info(string.Format("{0}: Send CR frame via tcp connection(LEP = {1}, REP={2}).",
                                          this.Context.RsspEP.ID, theConnection.LocalEndPoint, theConnection.RemoteEndPoint));
        }
Exemplo n.º 3
0
        public override void HandleTcpConnected(AleClientTunnel theConnection)
        {
            // 复位序号。
            this.Context.SeqNoManager.Initlialize();

            // TCP连接成功后发送ALE连接请求。
            this.SendConnectionRequestFrame(theConnection);

            // 通知观察器TCP连接已建立。
            var args = new TcpConnectedEventArgs(theConnection.ID,
                                                 this.Context.RsspEP.LocalID, theConnection.LocalEndPoint,
                                                 this.Context.RsspEP.RemoteID, theConnection.RemoteEndPoint);

            this.Context.TunnelEventNotifier.NotifyTcpConnected(args);

            // 设置下一个状态。
            this.Context.CurrentState = new AleWaitingForCcState(this.Context);

            // 启动握手超时计时器。
            theConnection.StartHandshakeTimer();
        }
Exemplo n.º 4
0
 public virtual void HandleTcpConnected(AleClientTunnel theConnection)
 {
     LogUtility.Error(string.Format("{0}: {1}.{2} not implement!",
                                    this.Context.RsspEP.ID, this.GetType().Name,
                                    new StackFrame(0).GetMethod().Name.Split('.').Last()));
 }