Question

I need to embed a tiny webserver in a compiled jsfl external library for Adobe Flash CS4 so that an outside process can communicate with it. The external library will be a Carbon bundle on Mac and a set of dlls on Windows, so the webserver will need to be embedded/loaded from C/C++ code with no external dependencies like Ruby. Most of the tiny webservers like fnord or mini-httpd have never been ported to the Mac or Windows but are mostly intended to be compiled on Linux. I was thinking of using a Lua based embedded webserver but not sure if that would work or not. Are there any embedded webservers that are easier than others to port to Windows and Mac?

Was it helpful?

Solution

All right, I finally answered this. After evaluating several webservers I found a gem, Mongoose. Mongoose is a very small embeddable web server written in C that compiles and runs easily on Linux, Mac, and Windows (there is an even a link in the wiki to getting it to run on the iPhone). Many webservers say they do this but Mongoose was really easy to get up and running. It just did exactly what I expected a little web server to do with minimal fuss. My previous approach, to use libevent or libev, I found a bit too hard, mostly because of threading issues I faced with my main GUI thread. Mongoose came with support for CGI and PHP but I actually found the C based handlers very easy to write so I stuck with that.

OTHER TIPS

Webrick and Mongrel run on both.

I thought of one other idea that is easier than Lua that I will try: using a webserver built with libevent. All I really need to do is serve up one file and I don't need any other HTTP features so something like the following might work:

http://3.rdrail.net/blog/libevent-webserver-in-40-lines-of-c/

I will report back.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top