• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# TimerEx类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中TimerEx的典型用法代码示例。如果您正苦于以下问题:C# TimerEx类的具体用法?C# TimerEx怎么用?C# TimerEx使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TimerEx类属于命名空间,在下文中一共展示了TimerEx类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SIP_UA_Registration

        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="stack">Owner SIP stack.</param>
        /// <param name="server">Registrar server URI. For example: sip:domain.com.</param>
        /// <param name="aor">Address of record. For example: [email protected]</param>
        /// <param name="contact">Contact URI.</param>
        /// <param name="expires">Gets after how many seconds reigisration expires.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>ua</b>,<b>server</b>,<b>transport</b>,<b>aor</b> or <b>contact</b> is null reference.</exception>
        /// <exception cref="ArgumentException">Is raised when any of the arguments contains invalid value.</exception>
        internal SIP_UA_Registration(SIP_Stack stack,SIP_Uri server,string aor,AbsoluteUri contact,int expires)
        {
            if(stack == null){
                throw new ArgumentNullException("stack");
            }
            if(server == null){
                throw new ArgumentNullException("server");
            }
            if(aor == null){
                throw new ArgumentNullException("aor");
            }
            if(aor == string.Empty){
                throw new ArgumentException("Argument 'aor' value must be specified.");
            }
            if(contact == null){
                throw new ArgumentNullException("contact");
            }

            m_pStack          = stack;
            m_pServer         = server;
            m_AOR             = aor;
            m_pContact        = contact;
            m_RefreshInterval = expires;

            m_pContacts = new List<AbsoluteUri>();

            m_pTimer = new TimerEx((m_RefreshInterval - 15) * 1000);
            m_pTimer.AutoReset = false;
            m_pTimer.Elapsed += new System.Timers.ElapsedEventHandler(m_pTimer_Elapsed);
            m_pTimer.Enabled = false;
        }
开发者ID:dioptre,项目名称:nkd,代码行数:41,代码来源:SIP_UA_Registration.cs


示例2: DNS_ClientCache

        /// <summary>
        /// Default constructor.
        /// </summary>
        internal DNS_ClientCache()
        {
            m_pCache = new Dictionary<string,CacheEntry>();

            m_pTimerTimeout = new TimerEx(60000);
            m_pTimerTimeout.Elapsed += new System.Timers.ElapsedEventHandler(m_pTimerTimeout_Elapsed);
            m_pTimerTimeout.Start();
        }
开发者ID:dioptre,项目名称:nkd,代码行数:11,代码来源:DNS_ClientCache.cs


示例3: SIP_FlowManager

            /// <summary>
            /// Default constructor.
            /// </summary>
            /// <param name="owner">Owner transport layer.</param>
            /// <exception cref="ArgumentNullException">Is raised when <b>owner</b> is null reference.</exception>
            internal SIP_FlowManager(SIP_TransportLayer owner)
            {
                if(owner == null){
                    throw new ArgumentNullException("owner");
                }

                m_pOwner = owner;

                m_pFlows = new Dictionary<string,SIP_Flow>();

                m_pTimeoutTimer = new TimerEx(15000);
                m_pTimeoutTimer.AutoReset = true;
                m_pTimeoutTimer.Elapsed += new System.Timers.ElapsedEventHandler(m_pTimeoutTimer_Elapsed);
                m_pTimeoutTimer.Enabled = true;
            }
开发者ID:dioptre,项目名称:nkd,代码行数:20,代码来源:SIP_TransportLayer.cs


示例4: DNS_ClientTransaction

        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="owner">Owner DNS client.</param>
        /// <param name="id">Transaction ID.</param>
        /// <param name="qtype">QTYPE value.</param>
        /// <param name="qname">QNAME value.</param>
        /// <param name="timeout">Timeout in milliseconds.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>owner</b> or <b>qname</b> is null reference.</exception>
        internal DNS_ClientTransaction(Dns_Client owner,int id,DNS_QType qtype,string qname,int timeout)
        {
            if(owner == null){
                throw new ArgumentNullException("owner");
            }
            if(qname == null){
                throw new ArgumentNullException("qname");
            }

            m_pOwner = owner;
            m_ID     = id;
            m_QName  = qname;
            m_QType  = qtype;
                        
            m_CreateTime    = DateTime.Now;
            m_pTimeoutTimer = new TimerEx(timeout);
            m_pTimeoutTimer.Elapsed += new System.Timers.ElapsedEventHandler(m_pTimeoutTimer_Elapsed);
        }
开发者ID:dioptre,项目名称:nkd,代码行数:27,代码来源:DNS_ClientTransaction.cs


示例5: UacInvite2xxRetransmissionWaiter

            /// <summary>
            /// Default constructor.
            /// </summary>
            /// <param name="dialog">Owner INVITE dialog.</param>
            /// <param name="invite">INVITE request which 2xx retransmission to wait.</param>
            /// <exception cref="ArgumentNullException">Is raised when <b>dialog</b> or <b>invite</b> is null reference.</exception>
            public UacInvite2xxRetransmissionWaiter(SIP_Dialog_Invite dialog, SIP_Request invite)
            {
                if (dialog == null)
                {
                    throw new ArgumentNullException("dialog");
                }
                if (invite == null)
                {
                    throw new ArgumentNullException("invite");
                }

                m_pDialog = dialog;
                m_pInvite = invite;

                /* RFC 3261 13.2.2.4.
                    The UAC core considers the INVITE transaction completed 64*T1 seconds
                    after the reception of the first 2xx response.
                */
                m_pTimer = new TimerEx(64*SIP_TimerConstants.T1, false);
                m_pTimer.Elapsed += m_pTimer_Elapsed;
                m_pTimer.Enabled = true;
            }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:28,代码来源:SIP_Dialog_Invite.cs


示例6: RTP_Session

        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="session">Owner RTP multimedia session.</param>
        /// <param name="localEP">Local RTP end point.</param>
        /// <param name="clock">RTP media clock.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>localEP</b>, <b>localEP</b> or <b>clock</b> is null reference.</exception>
        internal RTP_Session(RTP_MultimediaSession session, RTP_Address localEP, RTP_Clock clock)
        {
            if (session == null)
            {
                throw new ArgumentNullException("session");
            }
            if (localEP == null)
            {
                throw new ArgumentNullException("localEP");
            }
            if (clock == null)
            {
                throw new ArgumentNullException("clock");
            }

            m_pSession = session;
            m_pLocalEP = localEP;
            m_pRtpClock = clock;

            m_pRtpReceiveBuffer = new byte[Workaround.Definitions.MaxStreamLineLength];
            m_pRtcpReceiveBuffer = new byte[Workaround.Definitions.MaxStreamLineLength];

            m_pLocalSources = new List<RTP_Source_Local>();
            m_pTargets = new List<RTP_Address>();
            m_pMembers = new Dictionary<uint, RTP_Source>();
            m_pSenders = new Dictionary<uint, RTP_Source>();
            m_pConflictingEPs = new Dictionary<string, DateTime>();

            m_pRtpSocket = new Socket(localEP.IP.AddressFamily, SocketType.Dgram, ProtocolType.Udp);
            m_pRtpSocket.Bind(localEP.RtpEP);
            m_pRtcpSocket = new Socket(localEP.IP.AddressFamily, SocketType.Dgram, ProtocolType.Udp);
            m_pRtcpSocket.Bind(localEP.RtcpEP);

            m_pRtcpTimer = new TimerEx();
            m_pRtcpTimer.Elapsed += delegate { SendRtcp(); };
            m_pRtcpTimer.AutoReset = false;
        }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:44,代码来源:RTP_Session.cs


示例7: TCP_Client

 /// <summary>
 /// Default constructor.
 /// </summary>
 public TCP_Client()
 {
     m_pTimer_IdleTimeout = new TimerEx(30000, true);
     m_pTimer_IdleTimeout.Elapsed += new System.Timers.ElapsedEventHandler(m_pTimer_IdleTimeout_Elapsed);
 }
开发者ID:iraychen,项目名称:ourmsg,代码行数:8,代码来源:TCP_Client.cs


示例8: IDLE

        private bool IDLE(string cmdTag,string cmdText)
        {
            /* RFC 2177 3. IDLE Command.
                Arguments:  none

                Responses:  continuation data will be requested; the client sends
                            the continuation data "DONE" to end the command

                Result:     OK - IDLE completed after client sent "DONE"
                            NO - failure: the server will not allow the IDLE
                            command at this time
                BAD - command unknown or arguments invalid

                The IDLE command may be used with any IMAP4 server implementation
                that returns "IDLE" as one of the supported capabilities to the
                CAPABILITY command.  If the server does not advertise the IDLE
                capability, the client MUST NOT use the IDLE command and must poll
                for mailbox updates.  In particular, the client MUST continue to be
                able to accept unsolicited untagged responses to ANY command, as
                specified in the base IMAP specification.

                The IDLE command is sent from the client to the server when the
                client is ready to accept unsolicited mailbox update messages.  The
                server requests a response to the IDLE command using the continuation
                ("+") response.  The IDLE command remains active until the client
                responds to the continuation, and as long as an IDLE command is
                active, the server is now free to send untagged EXISTS, EXPUNGE, and
                other messages at any time.

                The IDLE command is terminated by the receipt of a "DONE"
                continuation from the client; such response satisfies the server's
                continuation request.  At that point, the server MAY send any
                remaining queued untagged responses and then MUST immediately send
                the tagged response to the IDLE command and prepare to process other
                commands. As in the base specification, the processing of any new
                command may cause the sending of unsolicited untagged responses,
                subject to the ambiguity limitations.  The client MUST NOT send a
                command while the server is waiting for the DONE, since the server
                will not be able to distinguish a command from a continuation.

                The server MAY consider a client inactive if it has an IDLE command
                running, and if such a server has an inactivity timeout it MAY log
                the client off implicitly at the end of its timeout period.  Because
                of that, clients using IDLE are advised to terminate the IDLE and
                re-issue it at least every 29 minutes to avoid being logged off.
                This still allows a client to receive immediate mailbox updates even
                though it need only "poll" at half hour intervals.

                Example:    C: A001 SELECT INBOX
                            S: * FLAGS (Deleted Seen)
                            S: * 3 EXISTS
                            S: * 0 RECENT
                            S: * OK [UIDVALIDITY 1]
                            S: A001 OK SELECT completed
                            C: A002 IDLE
                            S: + idling
                            ...time passes; new mail arrives...
                            S: * 4 EXISTS
                            C: DONE
                            S: A002 OK IDLE terminated
                            ...another client expunges message 2 now...
                            C: A003 FETCH 4 ALL
                            S: * 4 FETCH (...)
                            S: A003 OK FETCH completed
                            C: A004 IDLE
                            S: * 2 EXPUNGE
                            S: * 3 EXISTS
                            S: + idling
                            ...time passes; another client expunges message 3...
                            S: * 3 EXPUNGE
                            S: * 2 EXISTS
                            ...time passes; new mail arrives...
                            S: * 3 EXISTS
                            C: DONE
                            S: A004 OK IDLE terminated
                            C: A005 FETCH 3 ALL
                            S: * 3 FETCH (...)
                            S: A005 OK FETCH completed
            */

            if(!this.IsAuthenticated){
                m_pResponseSender.SendResponseAsync(new IMAP_r_ServerStatus(cmdTag,"NO","Authentication required."));

                return true;
            }

            m_pResponseSender.SendResponseAsync(new IMAP_r_ServerStatus("+","idling"));

            TimerEx timer = new TimerEx(30000,true);
            timer.Elapsed += new System.Timers.ElapsedEventHandler(delegate(object sender,System.Timers.ElapsedEventArgs e){
                try{
                    UpdateSelectedFolderAndSendChanges();
                }
                catch{
                }
            });
            timer.Enabled = true;

            // Read client response. 
            SmartStream.ReadLineAsyncOP readLineOP = new SmartStream.ReadLineAsyncOP(new byte[32000],SizeExceededAction.JunkAndThrowException);
//.........这里部分代码省略.........
开发者ID:MichaelChansn,项目名称:Lumisoft.Net,代码行数:101,代码来源:IMAP_Session.cs


示例9: ProcessResponse


//.........这里部分代码省略.........
                        // Stop timer A,B
                        if(m_pTimerA != null){
                            m_pTimerA.Dispose();
                            m_pTimerA = null;

                            // Log
                            if(this.Stack.Logger != null){
                                this.Stack.Logger.AddText(this.ID,"Transaction [branch='" + this.ID + "';method='" + this.Method + "';IsServer=false] timer A(INVITE request retransmission) stopped.");
                            }
                        }
                        if(m_pTimerB != null){
                            m_pTimerB.Dispose();
                            m_pTimerB = null;

                            // Log
                            if(this.Stack.Logger != null){
                                this.Stack.Logger.AddText(this.ID,"Transaction [branch='" + this.ID + "';method='" + this.Method + "';IsServer=false] timer B(INVITE calling state timeout) stopped.");
                            }
                        }

                        // 1xx response.
                        if(response.StatusCodeType == SIP_StatusCodeType.Provisional){
                            OnResponseReceived(response);
                            SetState(SIP_TransactionState.Proceeding);
                        }
                        // 2xx response.
                        else if(response.StatusCodeType == SIP_StatusCodeType.Success){
                            OnResponseReceived(response);
                            SetState(SIP_TransactionState.Accpeted);

                            /* RFC 6025 7.1.
                                When the "Accepted" state is entered, timer L MUST be set to fire in 64*T1.
                            */
                            m_pTimerM = new TimerEx(64 * SIP_TimerConstants.T1);
                            m_pTimerM.Elapsed += new System.Timers.ElapsedEventHandler(m_pTimerM_Elapsed);
                            m_pTimerM.Enabled = true;

                            // Log
                            if(this.Stack.Logger != null){
                                this.Stack.Logger.AddText(this.ID,"Transaction [branch='" + this.ID + "';method='" + this.Method + "';IsServer=true] timer M(2xx retransmission wait) started, will trigger after " + m_pTimerM.Interval + ".");
                            }
                        }
                        // 3xx - 6xx response.
                        else{
                            SendAck(response);
                            OnResponseReceived(response);
                            SetState(SIP_TransactionState.Completed);

                            /* RFC 3261 17.1.1.2. 
                                The client transaction SHOULD start timer D when it enters the "Completed" state, 
                                with a value of at least 32 seconds for unreliable transports, and a value of zero 
                                seconds for reliable transports.
                            */
                            m_pTimerD = new TimerEx(this.Flow.IsReliable ? 0 : 32000,false);
                            m_pTimerD.Elapsed += new System.Timers.ElapsedEventHandler(m_pTimerD_Elapsed);
                            // Log
                            if(this.Stack.Logger != null){
                                this.Stack.Logger.AddText(this.ID,"Transaction [branch='" + this.ID + "';method='" + this.Method + "';IsServer=false] timer D(INVITE 3xx - 6xx response retransmission wait) started, will trigger after " + m_pTimerD.Interval + ".");
                            }
                            m_pTimerD.Enabled = true;
                        }
                    }

                    #endregion

                    #region Proceeding
开发者ID:iraychen,项目名称:LumiSoft.Net,代码行数:67,代码来源:SIP_ClientTransaction.cs


示例10: SendResponse

        /// <summary>
        /// Sends specified response to remote party.
        /// </summary>
        /// <param name="response">SIP response to send.</param>
        /// <exception cref="ObjectDisposedException">Is raised when this class is Disposed and this method is accessed.</exception>
        /// <exception cref="ArgumentNullException">Is raised when <b>response</b> is null reference.</exception>
        public void SendResponse(SIP_Response response)
        {
            lock(this.SyncRoot){
                if(this.State == SIP_TransactionState.Disposed){
                    throw new ObjectDisposedException(this.GetType().Name);
                }
                if(response == null){
                    throw new ArgumentNullException("response");
                }

                try{
                    #region INVITE

                    /* RFC 6026 7.1. INVITE server transaction. (Udpates RFC 3261)   
                     
                                                             |INVITE
                                                             |pass INV to TU
                                          INVITE             V send 100 if TU won't in 200 ms
                                          send response+------------+
                                              +--------|            |--------+ 101-199 from TU
                                              |        |            |        | send response
                                              +------->|            |<-------+
                                                       | Proceeding |
                                                       |            |--------+ Transport Err.
                                                       |            |        | Inform TU
                                                       |            |<-------+
                                                       +------------+
                                          300-699 from TU |    |2xx from TU
                                          send response   |    |send response
                                           +--------------+    +------------+
                                           |                                |
                          INVITE           V          Timer G fires         |
                          send response +-----------+ send response         |
                               +--------|           |--------+              |
                               |        |           |        |              |
                               +------->| Completed |<-------+      INVITE  |  Transport Err.
                                        |           |               -       |  Inform TU
                               +--------|           |----+          +-----+ |  +---+
                               |        +-----------+    | ACK      |     | v  |   v
                               |          ^   |          | -        |  +------------+
                               |          |   |          |          |  |            |---+ ACK
                               +----------+   |          |          +->|  Accepted  |   | to TU
                               Transport Err. |          |             |            |<--+
                               Inform TU      |          V             +------------+
                                              |      +-----------+        |  ^     |
                                              |      |           |        |  |     |
                                              |      | Confirmed |        |  +-----+
                                              |      |           |        |  2xx from TU
                                Timer H fires |      +-----------+        |  send response
                                -             |          |                |
                                              |          | Timer I fires  |
                                              |          | -              | Timer L fires
                                              |          V                | -
                                              |        +------------+     |
                                              |        |            |<----+
                                              +------->| Terminated |
                                                       |            |
                                                       +------------+

                    */

                    if(this.Method == SIP_Methods.INVITE){
                        #region Proceeding

                        if(this.State == SIP_TransactionState.Proceeding){
                            AddResponse(response);

                            // 1xx
                            if(response.StatusCodeType == SIP_StatusCodeType.Provisional){
                                this.Stack.TransportLayer.SendResponse(this,response);
                                OnResponseSent(response);
                            }
                            // 2xx
                            else if(response.StatusCodeType == SIP_StatusCodeType.Success){
                                this.Stack.TransportLayer.SendResponse(this,response);
                                OnResponseSent(response);
                                SetState(SIP_TransactionState.Accpeted);

                                /* RFC 6025 7.1.
                                    When the "Accepted" state is entered, timer L MUST be set to fire in 64*T1.
                                */
                                m_pTimerL = new TimerEx(64 * SIP_TimerConstants.T1);
                                m_pTimerL.Elapsed += new System.Timers.ElapsedEventHandler(m_pTimerL_Elapsed);
                                m_pTimerL.Enabled = true;

                                // Log
                                if(this.Stack.Logger != null){
                                    this.Stack.Logger.AddText(this.ID,"Transaction [branch='" + this.ID + "';method='" + this.Method + "';IsServer=true] timer L(ACK wait) started, will trigger after " + m_pTimerL.Interval + ".");
                                }
                            }
                            // 3xx - 6xx
                            else{
                                this.Stack.TransportLayer.SendResponse(this,response);
                                OnResponseSent(response);
//.........这里部分代码省略.........
开发者ID:CivilPol,项目名称:LumiSoft.Net,代码行数:101,代码来源:SIP_ServerTransaction.cs


示例11: Start

        /// <summary>
        /// Starts transaction processing.
        /// </summary>
        /// <exception cref="ObjectDisposedException">Is raised when this class is Disposed and this method is accessed.</exception>
        /// <exception cref="InvalidOperationException">Is raised when <b>Start</b> is called other state than 'WaitingToStart'.</exception>
        public void Start()
        {   
            lock(this.SyncRoot){
                if(this.State == SIP_TransactionState.Disposed){
                    throw new ObjectDisposedException(this.GetType().Name);
                }
                else if(this.State != SIP_TransactionState.WaitingToStart){
                    throw new InvalidOperationException("Start method is valid only in 'WaitingToStart' state.");
                }

                // Move processing to thread pool.
                ThreadPool.QueueUserWorkItem(new WaitCallback(delegate(object state){
                    lock(this.SyncRoot){
                        #region INVITE

                        if(this.Method == SIP_Methods.INVITE){
                            /* RFC 3261 17.1.1.2.
                                The initial state, "calling", MUST be entered when the TU
                                initiates a new client transaction with an INVITE request.  The
                                client transaction MUST pass the request to the transport layer for
                                transmission (see Section 18).  If an unreliable transport is being
                                used, the client transaction MUST start timer A with a value of T1.
                                If a reliable transport is being used, the client transaction SHOULD
                                NOT start timer A (Timer A controls request retransmissions).  For
                                any transport, the client transaction MUST start timer B with a value
                                of 64*T1 seconds (Timer B controls transaction timeouts).
                            */

                            SetState(SIP_TransactionState.Calling);

                            try{
                                // Send initial request.
                                this.Stack.TransportLayer.SendRequest(this.Flow,this.Request,this);
                            }
                            catch(Exception x){
                                OnTransportError(x);
                                // NOTE: TransportError event handler could Dispose this transaction, so we need to check it.
                                if(this.State != SIP_TransactionState.Disposed){
                                    SetState(SIP_TransactionState.Terminated);
                                }
                                return;
                            }
                            
                            // Start timer A for unreliable transports.
                            if(!this.Flow.IsReliable){
                                m_pTimerA = new TimerEx(SIP_TimerConstants.T1,false);
                                m_pTimerA.Elapsed += new System.Timers.ElapsedEventHandler(m_pTimerA_Elapsed);
                                m_pTimerA.Enabled = true;

                                // Log
                                if(this.Stack.Logger != null){
                                    this.Stack.Logger.AddText(this.ID,"Transaction [branch='" + this.ID + "';method='" + this.Method + "';IsServer=false] timer A(INVITE request retransmission) started, will trigger after " + m_pTimerA.Interval + ".");
                                }
                            }

                            // Start timer B.
                            m_pTimerB = new TimerEx(64 * SIP_TimerConstants.T1,false);
                            m_pTimerB.Elapsed += new System.Timers.ElapsedEventHandler(m_pTimerB_Elapsed);
                            m_pTimerB.Enabled = true;

                            // Log
                            if(this.Stack.Logger != null){
                                this.Stack.Logger.AddText(this.ID,"Transaction [branch='" + this.ID + "';method='" + this.Method + "';IsServer=false] timer B(INVITE calling state timeout) started, will trigger after " + m_pTimerB.Interval + ".");
                            }
                        }

                        #endregion

                        #region Non-INVITE

                        else{
                            /* RFC 3261 17.1.2.2.
                                The "Trying" state is entered when the TU initiates a new client
                                transaction with a request.  When entering this state, the client
                                transaction SHOULD set timer F to fire in 64*T1 seconds.  The request
                                MUST be passed to the transport layer for transmission.  If an
                                unreliable transport is in use, the client transaction MUST set timer
                                E to fire in T1 seconds.
                            */

                            SetState(SIP_TransactionState.Trying);

                            // Start timer F.
                            m_pTimerF = new TimerEx(64 * SIP_TimerConstants.T1,false);
                            m_pTimerF.Elapsed += new System.Timers.ElapsedEventHandler(m_pTimerF_Elapsed);
                            m_pTimerF.Enabled = true;

                            // Log
                            if(this.Stack.Logger != null){
                                this.Stack.Logger.AddText(this.ID,"Transaction [branch='" + this.ID + "';method='" + this.Method + "';IsServer=false] timer F(Non-INVITE trying,proceeding state timeout) started, will trigger after " + m_pTimerF.Interval + ".");
                            }

                            try{
                                // Send initial request.
                                this.Stack.TransportLayer.SendRequest(this.Flow,this.Request,this);                                 
//.........这里部分代码省略.........
开发者ID:iraychen,项目名称:LumiSoft.Net,代码行数:101,代码来源:SIP_ClientTransaction.cs


示例12: RTP_Session

        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="session">Owner RTP multimedia session.</param>
        /// <param name="localEP">Local RTP end point.</param>
        /// <param name="clock">RTP media clock.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>localEP</b>, <b>localEP</b> or <b>clock</b> is null reference.</exception>
        internal RTP_Session(RTP_MultimediaSession session,RTP_Address localEP,RTP_Clock clock)
        {
            if(session == null){
                throw new ArgumentNullException("session");
            }
            if(localEP == null){
                throw new ArgumentNullException("localEP");
            }
            if(clock == null){
                throw new ArgumentNullException("clock");
            }

            m_pSession  = session;
            m_pLocalEP  = localEP;
            m_pRtpClock = clock;

            m_pLocalSources = new List<RTP_Source_Local>();
            m_pTargets = new List<RTP_Address>();
            m_pMembers = new Dictionary<uint,RTP_Source>();
            m_pSenders = new Dictionary<uint,RTP_Source>();
            m_pConflictingEPs = new Dictionary<string,DateTime>();
            m_pPayloads = new KeyValueCollection<int,Codec>();
            
            m_pUdpDataReceivers = new List<UDP_DataReceiver>();
            m_pRtpSocket = new Socket(localEP.IP.AddressFamily,SocketType.Dgram,ProtocolType.Udp);
            m_pRtpSocket.Bind(localEP.RtpEP);
            m_pRtcpSocket = new Socket(localEP.IP.AddressFamily,SocketType.Dgram,ProtocolType.Udp);
            m_pRtcpSocket.Bind(localEP.RtcpEP);
                        
            m_pRtcpTimer = new TimerEx();
            m_pRtcpTimer.Elapsed += new System.Timers.ElapsedEventHandler(delegate(object sender,System.Timers.ElapsedEventArgs e){
                SendRtcp();
            });
            m_pRtcpTimer.AutoReset = false;
        }
开发者ID:CivilPol,项目名称:LumiSoft.Net,代码行数:42,代码来源:RTP_Session.cs


示例13: Start

        /// <summary>
        /// Starts transaction processing.
        /// </summary>
        private void Start()
        {
            #region INVITE

            if(this.Method == SIP_Methods.INVITE){
                /* RFC 3261 17.2.1.
                    When a server transaction is constructed for a request, it enters the "Proceeding" state. The server 
                    transaction MUST generate a 100 (Trying) response unless it knows that the TU will generate a provisional 
                    or final response within 200 ms, in which case it MAY generate a 100 (Trying) response.
                */

                SetState(SIP_TransactionState.Proceeding);

                m_pTimer100 = new TimerEx(200,false);
                m_pTimer100.Elapsed += new System.Timers.ElapsedEventHandler(m_pTimer100_Elapsed);
                m_pTimer100.Enabled = true;
            }

            #endregion

            #region Non-INVITE

            else{
                // RFC 3261 17.2.2. The state machine is initialized in the "Trying" state.
                SetState(SIP_TransactionState.Trying);
            }

            #endregion
        }
开发者ID:CivilPol,项目名称:LumiSoft.Net,代码行数:32,代码来源:SIP_ServerTransaction.cs


示例14: ProcessRequest


//.........这里部分代码省略.........

                        #endregion

                        #region ACK

                        else if(request.RequestLine.Method == SIP_Methods.ACK){
                            #region Accepeted

                            if(this.State == SIP_TransactionState.Accpeted){
                                
                            }

                            #endregion

                            #region Completed

                            else if(this.State == SIP_TransactionState.Completed){
                                /* RFC 3261 17.2.1
                                    If an ACK is received while the server transaction is in the "Completed" state, the server transaction 
                                    MUST transition to the "Confirmed" state.  As Timer G is ignored in this state, any retransmissions of the 
                                    response will cease.
                         
                                    When this state is entered, timer I is set to fire in T4 seconds for unreliable transports, 
                                    and zero seconds for reliable transports.
                                */

                                SetState(SIP_TransactionState.Confirmed);

                                // Stop timers G,H
                                if(m_pTimerG != null){
                                    m_pTimerG.Dispose();
                                    m_pTimerG = null;

                                    // Log
                                    if(this.Stack.Logger != null){
                                        this.Stack.Logger.AddText(this.ID,"Transaction [branch='" + this.ID + "';method='" + this.Method + "';IsServer=true] timer G(INVITE response(3xx - 6xx) retransmission) stopped.");
                                    }
                                }
                                if(m_pTimerH != null){
                                    m_pTimerH.Dispose();
                                    m_pTimerH = null;

                                    // Log
                                    if(this.Stack.Logger != null){
                                        this.Stack.Logger.AddText(this.ID,"Transaction [branch='" + this.ID + "';method='" + this.Method + "';IsServer=true] timer H(INVITE ACK wait) stopped.");
                                    }
                                }

                                // Start timer I.
                                m_pTimerI = new TimerEx((flow.IsReliable ? 0 : SIP_TimerConstants.T4),false);
                                m_pTimerI.Elapsed += new System.Timers.ElapsedEventHandler(m_pTimerI_Elapsed);
                                // Log
                                if(this.Stack.Logger != null){
                                    this.Stack.Logger.AddText(this.ID,"Transaction [branch='" + this.ID + "';method='" + this.Method + "';IsServer=true] timer I(INVITE ACK retransission wait) started, will trigger after " + m_pTimerI.Interval + ".");
                                }
                                m_pTimerI.Enabled = true;
                            }

                            #endregion
                        }

                        #endregion
                    }

                    #endregion

                    #region Non-INVITE

                    else{
                        // Non-INVITE transaction may have only request retransmission requests.
                        if(this.Method == request.RequestLine.Method){
                            if(this.State == SIP_TransactionState.Proceeding){
                                /* RFC 3261 17.2.2.
                                    If a retransmission of the request is received while in the "Proceeding" state, the most
                                    recently sent provisional response MUST be passed to the transport layer for retransmission.
                                */
                                this.Stack.TransportLayer.SendResponse(this,this.LastProvisionalResponse);
                            }
                            else if(this.State == SIP_TransactionState.Completed){
                                /* RFC 3261 17.2.2.
                                    While in the "Completed" state, the server transaction MUST pass the final response to the transport
                                    layer for retransmission whenever a retransmission of the request is received.
                                */
                                this.Stack.TransportLayer.SendResponse(this,this.FinalResponse);
                            }
                        }
                    }

                    #endregion
                }
                catch(SIP_TransportException x){
                    // Log
                    if(this.Stack.Logger != null){
                        this.Stack.Logger.AddText(this.ID,"Transaction [branch='" + this.ID + "';method='" + this.Method + "';IsServer=true] transport exception: " + x.Message);
                    }

                    OnTransportError(x);
                }
            }
        }
开发者ID:CivilPol,项目名称:LumiSoft.Net,代码行数:101,代码来源:SIP_ServerTransaction.cs


示例15: UasInvite2xxRetransmit

            /// <summary>
            /// Default constructor.
            /// </summary>
            /// <param name="dialog">Owner INVITE dialog.</param>
            /// <param name="response">INVITE 2xx response.</param>
            /// <exception cref="ArgumentNullException">Is raised when <b>dialog</b> or <b>response</b> is null reference.</exception>
            public UasInvite2xxRetransmit(SIP_Dialog_Invite dialog, SIP_Response response)
            {
                if (dialog == null)
                {
                    throw new ArgumentNullException("dialog");
                }
                if (response == null)
                {
                    throw new ArgumentNullException("response");
                }

                m_pDialog = dialog;
                m_pResponse = response;

                /* RFC 3261 13.3.1.4.
                    Once the response has been constructed, it is passed to the INVITE
                    server transaction.  Note, however, that the INVITE server
                    transaction will be destroyed as soon as it receives this final
                    response and passes it to the transport.  Therefore, it is necessary
                    to periodically pass the response directly to the transport until the
                    ACK arrives.  The 2xx response is passed to the transport with an
                    interval that starts at T1 seconds and doubles for each
                    retransmission until it reaches T2 seconds (T1 and T2 are defined in
                    Section 17).  Response retransmissions cease when an ACK request for
                    the response is received.  This is independent of whatever transport
                    protocols are used to send the response.
                 
                        Since 2xx is retransmitted end-to-end, there may be hops between
                        UAS and UAC that are UDP.  To ensure reliable delivery across
                        these hops, the response is retransmitted periodically even if the
                        transport at the UAS is reliable.                    
                */

                m_pTimer = new TimerEx(SIP_TimerConstants.T1, false);
                m_pTimer.Elapsed += m_pTimer_Elapsed;
                m_pTimer.Enabled = true;
            }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:43,代码来源:SIP_Dialog_Invite.cs


示例16: Start

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TimerState类代码示例发布时间:2022-05-24
下一篇:
C# TimerCallback类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap