コード例 #1
0
ファイル: Connection.cs プロジェクト: anakiou/IEC-60870
        private void SendSFormatPdu()
        {
            var requestAPdu = new APdu(0, receiveSequenceNumber, APdu.ApciType.S_FORMAT, null);
            requestAPdu.Encode(buffer, settings);

            writer.Write(buffer, 0, 6);
            writer.Flush();

            acknowledgedReceiveSequenceNumber = receiveSequenceNumber;

            ResetMaxIdleTimeTimer();
        }
コード例 #2
0
ファイル: Connection.cs プロジェクト: anakiou/IEC-60870
        public void Send(ASdu aSdu)
        {
            acknowledgedReceiveSequenceNumber = receiveSequenceNumber;
            var requestAPdu = new APdu(sendSequenceNumber, receiveSequenceNumber, APdu.ApciType.FORMAT, aSdu);
            sendSequenceNumber = (sendSequenceNumber + 1)%32768;

            if (maxTimeNoAckSentFuture != null)
            {
                maxTimeNoAckSentFuture.Cancel();
                maxTimeNoAckSentFuture = null;
            }

            if (maxTimeNoAckReceivedFuture == null)
            {
                ScheduleMaxTimeNoAckReceivedFuture();
            }

            var length = requestAPdu.Encode(buffer, settings);
            writer.Write(buffer, 0, length);
            writer.Flush();

            ResetMaxIdleTimeTimer();
        }