Example #1
0
        public void BeginBind(SmppBindResHandler Callback, object State)
        {
            if ((_InternalConnection != null) && _InternalConnection.Connected)
            {
                throw new SmppException("Error Connecting: The connection is already Open.");
            }
            switch (_Settings.Recycling.Method)
            {
            case SmppSettings.RecyclingMethod.Pooling:
                _InternalConnection = SmppPoolManager.GetConnection(_Settings);
                break;

            case SmppSettings.RecyclingMethod.Sharing:
                _InternalConnection = SmppShareManager.GetConnection(_Settings);
                break;

            default:
                _InternalConnection = new SmppInternalConnection(_Settings);
                break;
            }
            SetEvents();
            if ((_InternalConnection.Connected && (_InternalConnection.LastBindRes != null)) &&
                ((_InternalConnection.LastBindRes.Header != null) &&
                 (_InternalConnection.LastBindRes.Header.CommandStatus == 0)))
            {
                Callback(this, new SmppAsyncBindResEventArgs(_InternalConnection.LastBindRes));
            }
            else
            {
                _InternalConnection.BeginBind(Callback, State);
            }
        }
Example #2
0
        public SmppBindRes Bind()
        {
            if ((_InternalConnection != null) && _InternalConnection.Connected)
            {
                throw new SmppException("Error Connecting: The connection is already Open.");
            }
            switch (_Settings.Recycling.Method)
            {
            case SmppSettings.RecyclingMethod.Pooling:
                _InternalConnection = SmppPoolManager.GetConnection(_Settings);
                break;

            case SmppSettings.RecyclingMethod.Sharing:
                _InternalConnection = SmppShareManager.GetConnection(_Settings);
                break;

            default:
                _InternalConnection = new SmppInternalConnection(_Settings);
                break;
            }
            SetEvents();
            SmppBindRes res = null;

            if ((_InternalConnection.Connected && (_InternalConnection.LastBindRes != null)) &&
                ((_InternalConnection.LastBindRes.Header != null) &&
                 (_InternalConnection.LastBindRes.Header.CommandStatus == 0)))
            {
                return(_InternalConnection.LastBindRes);
            }
            res = _InternalConnection.Bind();
            _InternalConnection.LastBindRes = res;
            return(res);
        }
Example #3
0
        public void UnBind()
        {
            try {
                switch (_Settings.Recycling.Method)
                {
                case SmppSettings.RecyclingMethod.Pooling:
                    SmppPoolManager.ReleaseConnection(_InternalConnection);
                    break;

                case SmppSettings.RecyclingMethod.None:
                    _InternalConnection.BeginUnBind();
                    goto Label_0034;
                }
Label_0034:
                UnSetEvents();
            } catch (Exception exception) {
                log.Error("Devshock", exception);
            }
        }