title: Get live stream from Network IP camera that support ONVIF protocol?
body: <p>I have network IP camera(Canon VB-M40). This camera support ONVIF protocol. I am implementing its ONVIF functionality in windows using C language. I got its RTSP URI using following request.</p>
  
  <pre><code>snprintf(postData, sizeof(postData),
        "&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;"
        "&lt;soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" "
        "xmlns:tds=\"http://www.onvif.org/ver10/media/wsdl\""
        "xmlns:tt=\"http://www.onvif.org/ver10/schema\"&gt;"             
        "&lt;soap:Body&gt;"
        "&lt;tds:GetStreamUri&gt;"
          "&lt;tds:StreamSetup&gt;"
            "&lt;tt:Stream&gt;0&lt;/tt:Stream&gt;" 
            "&lt;tt:Transport&gt;" 
              "&lt;tt:Protocol&gt;HTTP&lt;/tt:Protocol&gt;" 
            "&lt;/tt:Transport&gt;"
          "&lt;/tds:StreamSetup&gt;"
          "&lt;tds:ProfileToken&gt;profile1&lt;/tds:ProfileToken&gt;"
        "&lt;/tds:GetStreamUri&gt;"
          "&lt;/soap:Body&gt;&lt;/soap:Envelope&gt;",
        username, digest_str, nonce_str, time_str); 
  </code></pre>
  
  <p>and the response is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;SOAP-ENV:Envelope  xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" 
                      xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" 
                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                      xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                      xmlns:wsa5="http://www.w3.org/2005/08/addressing" 
                      xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#" 
                      xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" 
                      xmlns:ds="http://www.w3.org/2000/09/xmldsig#" 
                      xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" 
                      xmlns:MC2="http://www.onvif.org/ver10/schema" 
                      xmlns:MC3="http://www.w3.org/2005/05/xmlmime" 
                      xmlns:MC4="http://docs.oasis-open.org/wsn/b-2" 
                      xmlns:MC10="http://www.w3.org/2004/08/xop/include" 
                      xmlns:MC5="http://docs.oasis-open.org/wsrf/bf-2" 
                      xmlns:MC6="http://docs.oasis-open.org/wsn/t-1" 
                      xmlns:CC="http://www.canon.com/ns/networkcamera/onvif/va/schema" 
                      xmlns:MC1="http://www.onvif.org/ver10/media/wsdl" 
                      xmlns:MC8="http://www.onvif.org/ver20/analytics/wsdl/RuleEngineBinding" 
                      xmlns:MC9="http://www.onvif.org/ver20/analytics/wsdl/AnalyticsEngineBinding" 
                      xmlns:MC7="http://www.onvif.org/ver20/analytics/wsdl" 
                      xmlns:ter="http://www.onvif.org/ver10/error" 
                      xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" 
                      xmlns:tns1="http://www.onvif.org/ver10/topics"&gt;
      &lt;SOAP-ENV:Header&gt;&lt;/SOAP-ENV:Header&gt;
      &lt;SOAP-ENV:Body&gt;
          &lt;MC1:GetStreamUriResponse&gt;
              &lt;MC1:MediaUri&gt;
                  &lt;MC2:Uri&gt;rtsp://192.168.5.53:8090/profile1=r&lt;/MC2:Uri&gt;
                  &lt;MC2:InvalidAfterConnect&gt;false&lt;/MC2:InvalidAfterConnect&gt;
                  &lt;MC2:InvalidAfterReboot&gt;true&lt;/MC2:InvalidAfterReboot&gt;
                  &lt;MC2:Timeout&gt;PT0M0S&lt;/MC2:Timeout&gt;
              &lt;/MC1:MediaUri&gt;
          &lt;/MC1:GetStreamUriResponse&gt;
      &lt;/SOAP-ENV:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>according to ONVIF specification, once I get the stream URI I should send 'DESCRIBE' request to the device. I am using this procedure because I need stream on TCP.</p>
  
  <p>My question is how to send 'DESCRIBE' request to the Device and on which socket?  </p>
  
  <p>Should I send this request on the same socket on which I sent GetStreamURI request. Or I have to create an other one. And what will be the format of the request? </p>