public bool sendMessage(RTSP.Method method, QRTSPHeader header, string res, string body) { string head = ""; string methode = ""; string response = ""; switch (method) { case RTSP.Method.SETUP: methode = "SETUP"; break; case RTSP.Method.DESCRIBE: methode = "DESCRIBE"; break; } cseq++; header.Add("CSeq", cseq); head = methode + " rtsp://" + Host + ":" + Port + Res + " RTSP/1.0\r\n"; head += header.ToString(); sendRawMessage(head, body); return(true); }
public void Auhorize(string login,string password) { //SETUP rtsp://192.168.201.113 RTSP/1.0 //CSeq: 1 //Transport: RTP/AVP;unicast;client_port 4588-4589 //Authorization: Basic YWRtaW46NDQxOWI2M2Y1ZTUxOjEyMzQ= //User-Agent: VLC media player (LIVE555 Streaming Media v2010.02.10) QRTSPHeader header = new QRTSPHeader(); QRTSPHeader responseHeader = new QRTSPHeader(); string body = ""; int code = 0; header.Add ("Transport","RTP/AVP;unicast;client_port 4588-4589"); header.Add ("Authorization","Digest "+CalculateMD5Hash(login+":"+password)); header.Add ("User-Agent","VLC media player (LIVE555 Streaming Media v2010.02.10)"); if (sendMessage (RTSP.Method.DESCRIBE, header, "/", "")) { if(getMessage(ref responseHeader,ref body,ref code)) { } } string WWWAuthenticate = responseHeader.Get("WWW-Authenticate"); Console.WriteLine (">----------------------------------------------------"); Console.WriteLine (WWWAuthenticate.ToString()); Console.WriteLine (">----------------------------------------------------"); string nonce = (WWWAuthenticate.Split (',')) [1]; Console.WriteLine ("NONCE IS: [" + nonce+"]"); header.Add ("Transport","RTP/AVP;unicast;client_port 4588-4589"); header.Add ("Authorization","Digest "+CalculateMD5Hash(login+":"+nonce+":"+password)); header.Add ("User-Agent","VLC media player (LIVE555 Streaming Media v2010.02.10)"); if (sendMessage (RTSP.Method.DESCRIBE, header, "/", "")) { if(getMessage(ref responseHeader,ref body,ref code)) { } } }
public void Auhorize(string login, string password) { //SETUP rtsp://192.168.201.113 RTSP/1.0 //CSeq: 1 //Transport: RTP/AVP;unicast;client_port 4588-4589 //Authorization: Basic YWRtaW46NDQxOWI2M2Y1ZTUxOjEyMzQ= //User-Agent: VLC media player (LIVE555 Streaming Media v2010.02.10) QRTSPHeader header = new QRTSPHeader(); QRTSPHeader responseHeader = new QRTSPHeader(); string body = ""; int code = 0; header.Add("Transport", "RTP/AVP;unicast;client_port 4588-4589"); header.Add("Authorization", "Digest " + CalculateMD5Hash(login + ":" + password)); header.Add("User-Agent", "VLC media player (LIVE555 Streaming Media v2010.02.10)"); if (sendMessage(RTSP.Method.DESCRIBE, header, "/", "")) { if (getMessage(ref responseHeader, ref body, ref code)) { } } string WWWAuthenticate = responseHeader.Get("WWW-Authenticate"); Console.WriteLine(">----------------------------------------------------"); Console.WriteLine(WWWAuthenticate.ToString()); Console.WriteLine(">----------------------------------------------------"); string nonce = (WWWAuthenticate.Split(',')) [1]; Console.WriteLine("NONCE IS: [" + nonce + "]"); header.Add("Transport", "RTP/AVP;unicast;client_port 4588-4589"); header.Add("Authorization", "Digest " + CalculateMD5Hash(login + ":" + nonce + ":" + password)); header.Add("User-Agent", "VLC media player (LIVE555 Streaming Media v2010.02.10)"); if (sendMessage(RTSP.Method.DESCRIBE, header, "/", "")) { if (getMessage(ref responseHeader, ref body, ref code)) { } } }
public bool sendMessage(RTSP.Method method,QRTSPHeader header,string res,string body) { string head = ""; string methode = ""; string response = ""; switch (method) { case RTSP.Method.SETUP: methode = "SETUP"; break; case RTSP.Method.DESCRIBE: methode = "DESCRIBE"; break; } cseq++; header.Add ("CSeq", cseq); head = methode + " rtsp://" + Host + ":" + Port + Res + " RTSP/1.0\r\n"; head += header.ToString (); sendRawMessage(head,body); return true; }