Пример #1
0
        internal void SendTSH(MQTSH tsh)
        {
            uint method = 0x61c;

            this.TrEntry(method, new object[] { tsh });
            MQFAPConnection connection = this.Connection;

            try
            {
                if (this.IsEndRequested || (this.asyncFailure != null))
                {
                    NmqiException exception = new NmqiException(base.env, -1, null, 2, 0x7d9, this.asyncFailure);
                    throw exception;
                }
                byte[] tshBuffer = tsh.TshBuffer;
                byte[] buffer    = null;
                int    offset    = tsh.Offset;
                int    length    = tsh.Length;
                int    maxlength = length;
                base.TrData(method, 0, "Data before Processed by SendExits(if no exits are defined, this is final)", tshBuffer);
                if ((this.exitsActive && (this.exits != null)) && this.exits.sendExitDefined)
                {
                    buffer = this.exits.ProcessSendExits(ref tshBuffer, ref offset, ref length, ref maxlength);
                    base.TrData(method, 0, "Data after processed by SendExits", tshBuffer);
                }
                else
                {
                    buffer = tshBuffer;
                }
                try
                {
                    this.parentConnection.RequestSendLock();
                    connection.Send(buffer, offset, length, tsh.SegmentType, tsh.TSHType);
                }
                finally
                {
                    this.parentConnection.ReleaseSendLock();
                }
            }
            finally
            {
                tsh.ParentBuffer.Free();
                tsh.ParentBuffer = null;
                base.TrExit(method);
            }
        }
Пример #2
0
        internal void SendData(byte[] bytes, int offset, int length, byte segmentType, int tshType)
        {
            uint method = 0xb1;

            this.TrEntry(method, new object[] { bytes, offset, length });
            MQFAPConnection connection = this.Connection;

            byte[] buffer    = null;
            int    maxlength = length;

            try
            {
                if (this.IsEndRequested || (this.asyncFailure != null))
                {
                    NmqiException exception = new NmqiException(base.env, -1, null, 2, 0x7d9, this.asyncFailure);
                    throw exception;
                }
                base.TrData(method, 0, "Data before Processed by SendExits(if no exits are defined, this is final)", bytes);
                if ((this.exitsActive && (this.exits != null)) && this.exits.sendExitDefined)
                {
                    buffer = this.exits.ProcessSendExits(ref bytes, ref offset, ref length, ref maxlength);
                    base.TrData(method, 0, "Data after processed by SendExits", bytes);
                }
                else
                {
                    buffer = bytes;
                }
                try
                {
                    this.parentConnection.RequestSendLock();
                    connection.Send(buffer, offset, length, segmentType, tshType);
                    buffer = null;
                }
                finally
                {
                    this.parentConnection.ReleaseSendLock();
                }
            }
            finally
            {
                base.TrExit(method);
            }
        }