views:

156

answers:

1

Is there any way to use an Adobe AIR application as a local http server? i.e. Adobe AIR application listening to http://localhost:8020 and I'm able to use a browser to access the application? If I can, is it true or pseudo multithreading?

Is there any library or code that I can look for?

+1  A: 

The ability to listen to ports is a new feature in AIR 2, which ought to release soon but is currently in beta. If you're using version 2 though, you could certainly create an HTTP server if you want to. A general example of building a socket server can be found here.

Note that AIR apps are event-driven, not threaded. You can of course deal with multiple connections, so I suppose the runtime itself is driving them in different threads, but the code you write doesn't deal with threading or blocking, you just register for events on connection, data, etc. and handle them. (That may be what you mean by psuedo-threaded, I'm not really up on such things.)

However, there is a very big caveat to this, which is that AIR is not currently recommended by Adobe for headless server-like applications. As I understand it, there could be cases where the runtime popped up a confirmation dialog, and some things about the app might not work correctly until you remoted into the server to dismiss the dialog.

fenomas