Step 1: Installing Java

Make sure you are running an operating system that supports the Java JDK 6. My testing on the GFS Server has been on Windows (Vista) and Linux (Ubuntu 7.10). It should work on most Linux distros as well as most copies of Windows.

Download Java here

Once you have installed Java you will probably want to add it to your path so you can run Java from the command line. Click here to see how that is done.

Step 2: Setting up the MySQL database for GFS Server

If needed download and install MySQL (GFS Server was tested against MySQL 5). Use the following script to create the gfsserver database:

CREATE DATABASE `gfsserver`;

Now create the tables:

    CREATE TABLE `gfsserver`.`users` (
      `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
      `username` VARCHAR(15) NOT NULL,
      `password` VARCHAR(15) NOT NULL,
      `last_login` DATE NOT NULL,
      `is_active` VARCHAR(1) NOT NULL,
      PRIMARY KEY (`id`)
    )
    ENGINE = InnoDB;
    
    CREATE TABLE `gfsserver`.`user_properties` (
      `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
      `username` VARCHAR(15) NOT NULL,
      `property_name` VARCHAR(15) NOT NULL,
      `property_value` VARCHAR(100) NOT NULL,
      PRIMARY KEY (`id`)
    )
    ENGINE = InnoDB;
    
    CREATE TABLE `gfsserver`.`banned` (
      `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
      `ip_address` VARCHAR(250) NOT NULL,
      PRIMARY KEY (`id`)
    )
    ENGINE = InnoDB;
    
    CREATE TABLE `gfsserver`.`global_properties` (
      `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
      `property_name` VARCHAR(15) NOT NULL,
      `property_value` VARCHAR(100) NOT NULL,
      PRIMARY KEY (`id`)
    )
    ENGINE = InnoDB;

 

Step 3: Installing the MySQL JDBC driver

Download the MySQL JDBC driver if the supplied one will not work and extract the mysql-connector-java-X.X.X-bin.jar file to the GFSServer/lib/ directory.

Step 4: Installing GFS Server

Download the GFS Server and extract the files to a directory you wish to have it in.

Step 5: Running the GFS Server

To comply with the Flash Player's security you will need a crossdomainpolicy.xml file in the same folder as the GFSServer.jar file. The default file that ships with GFS Server looks like this:

<cross-domain-policy><allow-access-from domain="*" to-ports="843"/></cross-domain-policy>

As an example, if I wanted to limited connections to only SWFs on my domain I would use the following:

<cross-domain-policy><allow-access-from domain="*.giantflyingsaucer.com" to-ports="843"/></cross-domain-policy>

I would strongly suggest locking down your cross domain policy file to your domain name or IP for additional security

Configuration settings are passed via the command line. There are three arguments GFS Server expects for setting up the MySQL connection:

-mysql

-mysqlusername

-mysqlpassword

All are case sensitive so be careful.

To set the idle timeout (how much time a connected user gets to sit in an idle state before they are disconnected, ie: they are not doing anything so GFS Server will disconnect them to free up the connection). Here is the argument for that:

-idletimeout

Again, this is case sensitive. If nothing is specified GFS Server defaults to: 120. Which is two minutes (60 seconds times two). To set it to a ten minute timeout you would use: -idletimeout=600

The final command line argument is to allow new user accounts to be created, existing accounts to be deleted, or to enable/disable existing accounts. If not specified this will default to true. You would set this to false if you've crafted your own PHP, ASP, etc. page or program to create and manage accounts directly in the MySQL database.

-manageaccounts

Here is an example putting all this together:

java -jar GFSServer.jar -mysql=jdbc:mysql://127.0.0.1:3306/gfsserver -mysqlusername=gfsuser -mysqlpassword=password -idletimeout=120 -manageaccounts=false

You need to change the values to point to your MySQL database and the appropriate username/password. In the case above the MySQL Server is running on the same machine as GFS Server, is using port 3306 (MySQL's default port) and is going to connect to the database "gfsserver" (GFS Server's default database).

But wait! Theres more. Make sure to add the -server argument and then set the memory as needed (obviously you can modify these settings to suit your needs - perhaps you have more memory to spare, or less).

This one will work for both Linux and Windows and is "complete":

java -jar GFSServer.jar -server -Xms64m -Xmx256m -mysql=jdbc:mysql://127.0.0.1:3306/gfsserver -mysqlusername=gfsuser -mysqlpassword=password -idletimeout=120 -manageaccounts=false

If that doesn't work, your probably using the Java JRE rather than the Java JDK. Make sure the Java JDK "bin" is in your system's path. Also make sure the "lib" folder and crossdomainpolicy.xml are with the GFSServer.jar file. For example, here is a typical layout:

For Linux:

/usr/local/GFSServer/GFSServer.jar
/usr/local/GFSServer/crossdomainpolicy.xml
/usr/local/GFSServer/lib/



On Windows:

C:\GFSServer\GFSServer.jar
C:\GFSServer\lib\crossdomainpolicy.xml
C:\GFSServer\lib\

On Linux, if you would like to send the output to a file and run it in the background you can do this:

java -jar GFSServer.jar -server -Xms64m -Xmx256m -mysql=jdbc:mysql://127.0.0.1:3306/gfsserver -mysqlusername=gfsuser -mysqlpassword=password -idletimeout=120 -manageaccounts=false >> gfs.log &

Note: For Linux you need to be 'root' in order to open port 843. You will probably want to "cage" GFS Server then since it has been started as root or take some other sort of measures to protect the system.

Step 6 (Optional): Installing the Client Tools

If you extracted the GFS Server files to a development machine (where you plan to build Flex or Flash applications to talk to GFS Server then you will want to install the "Client Tools". Inside the "ClientTools" folder you will find the GFSClient.swc file. Lets install the Flash CS3 tools.

First, in your Flash CS3 installation folder look for "Configuration/Components". On a typical Windows Vista system this path might be like this:

C:\Program Files\Adobe\Adobe Flash CS3\en\Configuration\Components

Once your inside the "Components" folder create a new folder and call it "GFS". Copy the GFSClient.swc file from "ClientTools" in the GFS Server installation folder over to the new "GFS" folder you just created. If Flash CS3 is currently running you will need to reload the component panel. In order to do follow these steps:

Right-click the icon on the righthand side of the component panel and select "Reload" from the menu.

 

 

The new GFS Component should now be loaded. Follow the tutorials to learn how to use the new component.

 

To use the GFS Client Tools for Flex, please follow along the Flex tutorials to see how easy this is to do in Flex Builder 3.

Last Updated: Apr. 10, 2008

© 2008 Giant Flying Saucer. Site design by gorotron.