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); } }
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); }