During the Adobe AIR 2 beta, I wrote a simple Web Server application to explore the new Server Socket API available in AIR 2. Here is the updated version of the application for AIR 2 GA.
The “Mini AIR Web Server” is a simplistic implementation of an HTTPServer. Needless to say that it is far from being a production quality Web Server. The goal here is simply to use the well understood mechanics of a web server to learn how to use server sockets in AIR 2.0.
Installation Instructions
Make sure you have the AIR 2 runtime installed (you can download the AIR 2 runtime here), and install the application using the badge below:
Testing the Application
To test the application, open a browser and test the sample HTML pages provided with the application:
NOTE: You may have to change the port number in these URLs depending on the port number you enter in the application.
You can add your own content in the webroot folder in the applicationStorageDirectory.
Downloading the project
Click here to download the project
6 Comments
Darn that is actually COOL!
The usage of this could be endless in some levels.
How about FTP ? Is there any way to support FTP ?
Ive created a app that uses php on webserver but it is mean to use with FTP servers, looks like i have to wait till a nice FTP API
Thank you for this nice sample!
Do you know this issue :
http://bugs.adobe.com/jira/browse/FP-6
has been fixed in Air2 because I’ve seen in the sample the Socket class is used in write mode and because of the issue mentioned above, this could imply some limitations in a professional project.
That’s new life for flash^^
Nice short example!
I know that this is “far from being a production quality Web Server”, and it wouldn’t make sense to start pointing out everything in it that would have to be improved before it would be really usable…
But still, because it is a sample that is distributed to other developers (who will run it, and might use it as a basis for more), it would be better not expose the whole hard drive to the world through a directory traversal attack. A simple check if filePath contains “..” will probably do the trick.
bedava sinirsiz sorunsuz dinle iste.
I’m having a problem in 30s with AIR 2.0/BlazeDS request.. My project is almost finished. Can you help me? The error is not a requestTimeout. Error message: http://bit.ly/9m5Jwv
4 Trackbacks
[...] Direct Link [...]
[...] Creating a Web Server using the new Server Socket API in AIR 2 [...]
[...] 理解Flash Player 10.1和AIR2里的安全变化 • 使用AIR2里新的Server Socket访问一个Web Server • 探索“以默认应用开始的”API • [...]
[...] 2• 理解Flash Player 10.1和AIR2里的安全变化• 使用AIR2里新的Server Socket访问一个Web Server• 探索“以默认应用开始的”API• [...]