Creating a Web Server using the new Server Socket API in AIR 2

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:

Please upgrade your Flash Player This is the content that would be shown if the user does not have Flash Player 9.0.115 or higher installed.

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

Comments

  1. Danel Kirch says:

    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

  2. Grégory Pelletier says:

    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.

  3. zhaiduo says:

    That’s new life for flash^^

  4. Wouter Coekaerts says:

    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.

  5. muzik dinle says:

    bedava sinirsiz sorunsuz dinle iste.

  6. Daniel says:

    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

  7. I’m glad to have visited your blog and good to know you! I find it interesting and informative. Content Management System (CMS Application) covers the complete life cycle of your site, right from the creation through the organization, division, to publishing the information.

Trackbacks

  1. [...] Creating a Web Server using the new Server Socket API in AIR 2 [...]

  2. [...]       理解Flash Player 10.1和AIR2里的安全变化 •        使用AIR2里新的Server Socket访问一个Web Server •        探索“以默认应用开始的”API •        [...]

  3. [...] 2•        理解Flash Player 10.1和AIR2里的安全变化•        使用AIR2里新的Server Socket访问一个Web Server•        探索“以默认应用开始的”API•        [...]

  4. Bariatric Surgery Arlington…

    [...]below you’ll find the link to some sites that we think you should visit[...]…

Speak Your Mind

*