コード例 #1
0
        private void PduRequestProcessorCallback(RequestPdu pdu)
        {
            ResponsePdu resp = null;

            if (pdu is Unbind)
            {
                resp = pdu.CreateDefaultResponce();
                try { SendPduBase(resp); }
                catch { /*silent catch*/ }
                EndSession(SmppSessionCloseReason.UnbindRequested, null);
                return;
            }
            resp = RaisePduReceivedEvent(pdu);
            if (resp == null)
            {
                if (pdu.HasResponse)
                {
                    resp = pdu.CreateDefaultResponce();
                }
            }
            if (resp != null)
            {
                try { SendPduBase(resp); } catch { /*Silent catch*/ }
            }
        }
コード例 #2
0
        private void PduErrorEventHandler(object sender, PduErrorEventArgs e)
        {
            ResponsePdu resp = null;

            if (e.Pdu is RequestPdu)
            {
                RequestPdu req = (RequestPdu)e.Pdu;
                resp = req.CreateDefaultResponce();
                resp.Header.ErrorCode = e.Exception.ErrorCode;
            }
            else
            {
                resp = new GenericNack(e.Header);
                resp.Header.ErrorCode = e.Exception.ErrorCode;
            }
            try { SendPduBase(resp); }
            catch { /*silent catch*/ }
        }