Example #1
0
        /// <summary>
        /// Посылает запрос через tcpClient и получает ответ
        /// </summary>
        /// <param name="request">Посылаемый запрос</param>
        /// <param name="tcpClient">Соединение, с помощью которого нужно послать запрос</param>
        /// <returns>RTSP-ответ, завернутый в класс RTSPResponse</returns>
        public static RTSPResponse Get(RTSPRequest request, TcpClient tcpClient)
        {
            string req      = request.ToString();
            string response = Send(req, tcpClient);

            return(RTSPResponse.Parse(response));
        }
Example #2
0
        private RTSPResponse Send(RTSPRequest request)
        {
            RTSPResponse resp = RTSPResponse.Get(request, tcpClient);

            CSeq++;
            if (resp.StatusCode != 200)
            {
                throw new Exception("RTSPResponse " + resp.StatusCode);
            }
            else
            {
                return(resp);
            }
        }
Example #3
0
        public void Teardown()
        {
            if (tcpClient == null)
            {
                return;
            }

            string localPath = uri.LocalPath;

            if (localPath[localPath.Length - 1] != '/')
            {
                localPath += '/';
            }

            Send(RTSPRequest.CreateTeardown(String.Format("rtsp://{0}{1}", uri.DnsSafeHost, localPath), CSeq, this.Parameters.Session));
        }
Example #4
0
 private RTSPResponse Send(RTSPRequest request)
 {
     RTSPResponse resp = RTSPResponse.Get(request, tcpClient);
     CSeq++;
     if (resp.StatusCode != 200)
     {
         throw new Exception("RTSPResponse " + resp.StatusCode);
     }
     else
     {
         return resp;
     }
 }
Example #5
0
 /// <summary>
 /// Посылает запрос через tcpClient и получает ответ
 /// </summary>
 /// <param name="request">Посылаемый запрос</param>
 /// <param name="tcpClient">Соединение, с помощью которого нужно послать запрос</param>
 /// <returns>RTSP-ответ, завернутый в класс RTSPResponse</returns>
 public static RTSPResponse Get(RTSPRequest request, TcpClient tcpClient)
 {
     string req = request.ToString();
     string response = Send(req, tcpClient);
     return RTSPResponse.Parse(response);
 }
Example #6
0
 public RTSPResponse Play(string session)
 {
     return(Send(RTSPRequest.CreatePlay(uri.AbsoluteUri, CSeq, session)));
 }
Example #7
0
 public RTSPResponse Setup(string url, int RTPClientPort, int RTCPClientPort, string session = "")
 {
     return(Send(RTSPRequest.CreateSetup(url, CSeq, RTPClientPort, RTCPClientPort, session)));
 }
Example #8
0
 public RTSPResponse Describe()
 {
     return(Send(RTSPRequest.CreateDescribe(uri.AbsoluteUri, CSeq)));
 }
Example #9
0
 public RTSPResponse Options()
 {
     return(Send(RTSPRequest.CreateOptions(uri.AbsoluteUri, CSeq)));
 }