Esempio n. 1
0
        public int ConnectTry()
        {
            if (this.remoteEP == null) return -1;


            if (this.connectionStatus == MvaWacohForceEnumConnectionStatus.Connecting) return 1;

            this.netNonStopTcpClient.ConnectTry();
            if (this.netNonStopTcpClient.IsLocalReadyConnect)
                this.connectionStatus = MvaWacohForceEnumConnectionStatus.Connecting;

            return 0;
        }
Esempio n. 2
0
        public MvaWacohForceLdd()
        {
            this.netNonStopTcpClient.EhDataReceive += (sender, e) =>
            {
                var ee = e as CtkNonStopTcpStateEventArgs;
                var msg = ee.TrxMessageBuffer;
                this.messageReceiver.Receive(msg.Buffer, msg.Offset, msg.Length);
                this.messageReceiver.AnalysisMessage();

                if (this.messageReceiver.Count == 0) return;

                var vec = this.messageReceiver.Dequeue();
                if (this.correctionFlag)
                {
                    this.centerForceVector = vec;
                    lock (this)
                        correctionFlag = false;
                }

                var ea = new MvaWacohForceMessageEventArgs();
                ea.centerForceVector = this.centerForceVector;
                ea.rawForceVector = vec;
                this.OnDataReceive(ea);
            };


            this.netNonStopTcpClient.EhDisconnect += (sender, e) =>
            {
                this.connectionStatus = MvaWacohForceEnumConnectionStatus.Disconnection;
            };
            this.netNonStopTcpClient.EhFirstConnect += (sender, e) =>
            {
                this.connectionStatus = MvaWacohForceEnumConnectionStatus.Connected;
            };

        }