You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Héctor Garcia Peris <he...@ivie.es> on 2002/03/13 09:56:46 UTC

Problem with x-mixed-replace mime type

Hello all,

I'm new in this list and I take this opportunity to send my greetings to 
all. I don't know if this is the correct list to ask my question, but here 
is it.

I'm writing a program in C that reads from a web camera an image with 
intervals of 10 seconds. This is the code of the program:

#include <stdio.h>
#include <stdlib.h>

int  main (argc, argv)
int argc;
char *argv[];
{
         printf("Content-Type: multipart/x-mixed-replace;boundary=cadena\n\n");
         printf("--cadena\n");
         while (1)
         {
                 printf("Content-Type: image/jpeg\n\n");
                 fflush(stdout);
                 system("wget -O - http://@camara/cgi-bin/jpg/image.cgi 
2>/dev/null");
                 printf("\n--cadena\n");
                 fflush(stdout);
                 sleep(10);
         }
         exit(0);
}

I put this program under the cgi-bin directory and I hope that each 10 
seconds the cgi sends me an image from the camera. But the program doesn't 
makes this. It only sends one image and finishes the connection. I get the 
headers sent by my cgi with the lynx navigator and I get this:

HTTP/1.1 200 OK
Date: Wed, 13 Mar 2002 08:45:15 GMT
Server: Apache/1.3.14 (Unix) Debian/GNU PHP/4.0.4pl1
Connection: close
Content-Type: multipart/x-mixed-replace;boundary=cadena

What am I making wrong?

Thanks.



---------------------------------------------------------------------
Héctor Garcia Peris
Dpto. Informática
Instituto Valenciano de Investigaciones Económicas S.A. (Ivie)
C/ Guardia Civil, 22 esc-2 1º 46020 - Valencia (Spain)
Tfno.: +34 - 963190050 / +34 - 963930816
Fax.: +34 - 963190055 / +34 - 963930856
e-mail: hector.garcia@ivie.es
----------------------------------------------------------------------



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Problem with x-mixed-replace mime type

Posted by Steven Pierce <pa...@speakeasy.net>.
Hector,

I am by no means a great programmer, but from what I can see
in the code it looks like you do not have a loop of any kind.  So
it goes through the code (Once) and then stops.  It does not appear
to have anyway to go back and get the next one.  

*********** REPLY SEPARATOR  ***********

On 3/13/2002 at 9:56 AM Héctor Garcia Peris wrote:

>Hello all,
>
>I'm new in this list and I take this opportunity to send my greetings to 
>all. I don't know if this is the correct list to ask my question, but here 
>is it.
>
>I'm writing a program in C that reads from a web camera an image with 
>intervals of 10 seconds. This is the code of the program:
>
>#include <stdio.h>
>#include <stdlib.h>
>
>int  main (argc, argv)
>int argc;
>char *argv[];
>{
>         printf("Content-Type:
>multipart/x-mixed-replace;boundary=cadena\n\n");
>         printf("--cadena\n");
>         while (1)
>         {
>                 printf("Content-Type: image/jpeg\n\n");
>                 fflush(stdout);
>                 system("wget -O - http://@camara/cgi-bin/jpg/image.cgi 
>2>/dev/null");
>                 printf("\n--cadena\n");
>                 fflush(stdout);
>                 sleep(10);
>         }
>         exit(0);
>}
>
>I put this program under the cgi-bin directory and I hope that each 10 
>seconds the cgi sends me an image from the camera. But the program doesn't 
>makes this. It only sends one image and finishes the connection. I get the 
>headers sent by my cgi with the lynx navigator and I get this:
>
>HTTP/1.1 200 OK
>Date: Wed, 13 Mar 2002 08:45:15 GMT
>Server: Apache/1.3.14 (Unix) Debian/GNU PHP/4.0.4pl1
>Connection: close
>Content-Type: multipart/x-mixed-replace;boundary=cadena
>
>What am I making wrong?
>
>Thanks.
>
>
>
>---------------------------------------------------------------------
>Héctor Garcia Peris
>Dpto. Informática
>Instituto Valenciano de Investigaciones Económicas S.A. (Ivie)
>C/ Guardia Civil, 22 esc-2 1º 46020 - Valencia (Spain)
>Tfno.: +34 - 963190050 / +34 - 963930816
>Fax.: +34 - 963190055 / +34 - 963930856
>e-mail: hector.garcia@ivie.es
>----------------------------------------------------------------------
>
>
>
>---------------------------------------------------------------------
>The official User-To-User support forum of the Apache HTTP Server Project.
>See <URL:http://httpd.apache.org/userslist.html> for more info.
>To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>For additional commands, e-mail: users-help@httpd.apache.org




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org