Exemple #1
0
        internal static SmppInternalConnection GetConnection(SmppSettings Settings)
        {
            SmppPool pool;

            if (Deactivated)
            {
                throw new SmppException("The SmppPoolManager is in process of deactivation");
            }
            if (Pools == null)
            {
                Initialize();
            }
            string connectionString = Settings.ConnectionString;

            lock (Pools.SyncRoot) {
                if (!Pools.Contains(connectionString))
                {
                    pool = new SmppPool(Settings);
                    Pools.Add(connectionString, pool);
                }
                else
                {
                    pool          = Pools[connectionString] as SmppPool;
                    pool.Settings = Settings;
                }
            }
            return(pool.GetConnection());
        }
Exemple #2
0
 public SmppShare(SmppSettings Settings) {
   this.Settings = Settings;
   availablePool = new SmppInternalConnection[Settings.Recycling.MaxSize];
   for (int i = 0; i < availablePool.Length; i++)
     availablePool[i] = new SmppInternalConnection(Settings);
   tmCheckIdleConn.AutoReset = false;
   tmCheckIdleConn.Enabled = true;
   tmCheckIdleConn.Elapsed += tmCheckIdleConn_Elapsed;
 }
Exemple #3
0
 public SmppShare(SmppSettings Settings)
 {
     this.Settings = Settings;
     availablePool = new SmppInternalConnection[Settings.Recycling.MaxSize];
     for (int i = 0; i < availablePool.Length; i++)
     {
         availablePool[i] = new SmppInternalConnection(Settings);
     }
     tmCheckIdleConn.AutoReset = false;
     tmCheckIdleConn.Enabled   = true;
     tmCheckIdleConn.Elapsed  += tmCheckIdleConn_Elapsed;
 }
 public SmppInternalConnection(SmppSettings Settings) {
   TcpConnection = new SockClient();
   PendingResponse = new ListDictionary();
   PendingQueue = new ArrayList(15);
   PendingBind = new ArrayList(10);
   ReleasedDateTime = DateTime.Now;
   LastReceptionTime = DateTime.Now;
   ClientGuid = Guid.NewGuid();
   this.Settings = Settings;
   TcpConnection.DataReceived += TcpConnection_DataReceived;
   TcpConnection.CloseConnection += TcpConnection_CloseConnection;
 }
 public SmppInternalConnection(SmppSettings Settings)
 {
     TcpConnection                  = new SockClient();
     PendingResponse                = new ListDictionary();
     PendingQueue                   = new ArrayList(15);
     PendingBind                    = new ArrayList(10);
     ReleasedDateTime               = DateTime.Now;
     LastReceptionTime              = DateTime.Now;
     ClientGuid                     = Guid.NewGuid();
     this.Settings                  = Settings;
     TcpConnection.DataReceived    += TcpConnection_DataReceived;
     TcpConnection.CloseConnection += TcpConnection_CloseConnection;
 }
Exemple #6
0
 public SmppPool(SmppSettings Settings) {
   _Settings = Settings;
   inUsePool = new ArrayList();
   idlePool = new ArrayList(Settings.Recycling.MinSize);
   lock (idlePool.SyncRoot) {
     lock (inUsePool.SyncRoot) {
       for (int i = 0; i < Settings.Recycling.MinSize; i++) {
         var connection = new SmppInternalConnection(Settings);
         idlePool.Add(connection);
       }
     }
   }
   tmCheckIdleConn.AutoReset = false;
   tmCheckIdleConn.Enabled = true;
   tmCheckIdleConn.Elapsed += tmCheckIdleConn_Elapsed;
 }
 internal static SmppInternalConnection GetConnection(SmppSettings Settings) {
   SmppShare share;
   if (Deactivated)
     throw new SmppException("The SmppPoolManager is in process of deactivation");
   if (Pools == null)
     Initialize();
   string connectionString = Settings.ConnectionString;
   lock (Pools.SyncRoot) {
     if (!Pools.Contains(connectionString)) {
       share = new SmppShare(Settings);
       Pools.Add(connectionString, share);
     } else {
       share = Pools[connectionString] as SmppShare;
       share.Settings = Settings;
     }
   }
   return share.GetConnection();
 }
Exemple #8
0
 public SmppPool(SmppSettings Settings)
 {
     _Settings = Settings;
     inUsePool = new ArrayList();
     idlePool  = new ArrayList(Settings.Recycling.MinSize);
     lock (idlePool.SyncRoot) {
         lock (inUsePool.SyncRoot) {
             for (int i = 0; i < Settings.Recycling.MinSize; i++)
             {
                 var connection = new SmppInternalConnection(Settings);
                 idlePool.Add(connection);
             }
         }
     }
     tmCheckIdleConn.AutoReset = false;
     tmCheckIdleConn.Enabled   = true;
     tmCheckIdleConn.Elapsed  += tmCheckIdleConn_Elapsed;
 }
 internal static SmppInternalConnection[] GetConnections(SmppSettings Settings) {
   var share = Pools[Settings.ConnectionString] as SmppShare;
   return share.GetConnections();
 }
Exemple #10
0
 public SmppConnection(SmppSettings ConnectionSettings) {
   _Settings = ConnectionSettings;
 }
Exemple #11
0
 public SmppConnection(SmppSettings ConnectionSettings)
 {
     _Settings = ConnectionSettings;
 }
        internal static SmppInternalConnection[] GetConnections(SmppSettings Settings)
        {
            var share = Pools[Settings.ConnectionString] as SmppShare;

            return(share.GetConnections());
        }