Menu

#2 "streaming" via server push?

open
nobody
None
5
2001-06-26
2001-06-26
Anonymous
No

I can't write C, but the concept is simple:

if (conf->format == "stream") {
#define BORDER "thisisamultipartborder";

print "Content-type: multipart/x-mixed-replace;
boundary=\"BORDER\"";
print "\r\n--BORDER\r\n";

while (1) {
grab_new_image();
print "Content-Type: image/jpeg\r\n";
printf "Content-Length: %d\r\b",
sizeofjpeg(grabbed_image));
print "\r\n";
print grabbed_image;
print "\r\n--BORDER\r\n";
sleep(conf->sleep);
}
}

of course, apache probably has special directives for
print()ing out to the client, and the while(1) would
probably blow up apache, you should get the general idea.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB