SIPSorcery.Net.RTSPClient.Close C# (CSharp) Méthode

Close() public méthode

Closes the session and the RTSP connection to the server.
public Close ( ) : void
Résultat void
        public void Close()
        {
            try
            {
                if (!_isClosed)
                {
                    logger.Debug("RTSP client, closing connection for " + _url + ".");

                    _isClosed = true;
                    _sendKeepAlivesMRE.Set();

                    Teardown();

                    if (_rtspSession != null && !_rtspSession.IsClosed)
                    {
                        _rtspSession.Close();
                    }

                    if (_rtspStream != null)
                    {
                        try
                        {
                            _rtspStream.Close();
                        }
                        catch (Exception rtpStreamExcp)
                        {
                            logger.Error("Exception RTSPClient.Close closing RTP stream. " + rtpStreamExcp);
                        }
                    }

                    if (OnClosed != null)
                    {
                        OnClosed(this);
                    }
                }
            }
            catch (Exception excp)
            {
                logger.Error("Exception RTSPClient.Close. " + excp);
            }
        }