Receiving JPEG images via http GET request
<p>I want to receive images from an IP camera over HTTP via GET request. I have written a program that creates TCP socket connection with the camera and sends the following GET request to the camera:</p>

<pre><code>GET /mjpeg?res=full HTTP/1.1\r\nHost: 143.205.116.14\r\n\r\n
</code></pre>

<p>After that, I receive images with the following function in a while loop:</p>

<pre><code>while((tmpres = recv(sock,(void *) buf, SIZE, 0)) &gt; 0 &amp;&amp; check&lt;10)
</code></pre>

<p>.....</p>

<p>where <code>SIZE</code> represents the size of the buffer. I, infact, don't know what size to define here. I am receiving a color image of size 2940x1920. So I define <code>SIZE=2940x1920x3</code>. After receiving the MJPEG image, I decode it with ffmpeg. But I observe that ffmpeg just partially/uncorrectly decodes the image and I just see a half (or even less) of the image. I assume it could be a size problem. 
Any help in this regard would be highly appreciated.</p>

<p>Regards,</p>

<p>Khan</p>
