Example #1
0
 /// <summary>
 /// This is used to destroy a session during the unbind process.
 /// </summary>
 /// <param name="session">Session being ended</param>
 internal void EndSession(SmscSession session)
 {
     lock (clients_)
     {
         clients_.Remove(session);
     }
 }
Example #2
0
        /// <summary>
        /// This method is invoked when a new inbound socket hits our server.  We will create a new
        /// SMPP session object to manage the socket and begin communicating with the ESME session.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        protected void OnStartSession(object sender, SocketEventArgs args)
        {
            ConnectEventArgs connEv = (ConnectEventArgs)args;
            SocketClient     scNew  = connEv.Client;

            // Create a new SMPP session to manage this connection.
            SmscSession newSession = new SmscSession(this, scNew, systemid_);

            // Back-link the session
            scNew.Tag = newSession;

            // Notify anyone who wants to know
            SmppConnectEventArgs sce = new SmppConnectEventArgs(scNew.Address, newSession);

            if (OnNewSession != null)
            {
                OnNewSession(this, sce);
            }
            if (!sce.AllowConnection)
            {
                scNew.Close(true);
            }
            else
            {
                scNew.OnEndSession += OnEndClientSession;
                lock (clients_)
                {
                    clients_.Add(newSession);
                }
            }
        }
Example #3
0
        /// <summary>
        /// This method is called when a client socket disconnects.  We need to remove the session from
        /// our socket list; it will remain around until it disconnects from the socket notify list.
        /// </summary>
        /// <param name="sender">Socket notify</param>
        /// <param name="args">Disconnect args</param>
        protected void OnEndClientSession(object sender, SocketEventArgs args)
        {
            SocketClient        sock    = (SocketClient)sender;
            DisconnectEventArgs de      = (DisconnectEventArgs)args;
            SmscSession         session = sock.Tag as SmscSession;

            sock.Tag = null;
            if (session != null)
            {
                EndSession(session);
            }
        }
Example #4
0
 /// <summary>
 /// Constructor for the open session state
 /// </summary>
 /// <param name="sess"></param>
 public SmscOpenSessionState(SmscSession sess)
 {
     session_ = sess;
 }
Example #5
0
 /// <summary>
 /// Constructor for the bound receiver session state
 /// </summary>
 /// <param name="sess"></param>
 public SmscBoundTRXSessionState(SmscSession sess)
     : base(sess)
 {
     rx_ = new SmscBoundRXSessionState(sess);
     tx_ = new SmscBoundTXSessionState(sess);
 }
 /// <summary>
 /// Constructor for the bound receiver session state
 /// </summary>
 /// <param name="sess"></param>
 public SmscBoundRXSessionState(SmscSession sess)
     : base(sess)
 {
 }
 /// <summary>
 /// Constructor for the bound receiver session state
 /// </summary>
 /// <param name="sess"></param>
 public SmscBoundSessionState(SmscSession sess)
 {
     session_ = sess;
 }