Still for Püsh project, we need a server to share data between many devices and synchronize everything, so we use SmartFoxServer.
There is a free version (until 20 connections). I use Pro Version 1.6.6. I had some troubles starting with, it’s not always clear, especially to begin and understand general structure.
Light / Basic / Pro
Light version doesn’t bear AS3, if you want to code in AS3, you need Basic or Pro Version.
Network
In config.xml file (server directory) are defined IP and server port. In Pro Version all IPs are allowed (*) by default, but in Basic, it seems to point to localhost (change it if you want to make a network).
And if you are in a school network, maybe you haven’t all the rights… I tested a chat application, which worked well on a device if server was on the same device, but it was impossible to reach it from another device (in fact it was possible but Flash wasn’t agree -2048 error : security sandbox violation-). A solution is to put server on an external computer (laptop), where you have all the rights, if you can test from an other place.
Samples
Samples (as3) don’t have all the necessary source codes in order to an application works : there is only specific source codes for this application, you must add missing librairies (it.gotoandplay…).
Java
(general)
To compile Java classes, you must have all tools (jdk…) and well ordered ; I’ve must define environment variables : JAVA_HOME and PATH. You can do that by command-line or by system properties. For XP : My Computer > (left column) System Tasks > View system information > (tab) Advanced > Environment Variables. And there you must add/change them.
JAVA_HOME must point to directory where jdk is (e.g. “C:\Program Files\Java\jdk1.6.0_13”) and PATH to bin of jdk (e.g. “C:\Program Files\Java\jdk1.6.0_13\bin”). If there is a blank in your path (e.g. “Program Files”) it’s better to put the entire path between quotes. If variables already exist, you can put a new value without erase existing values by adding after a semicolon.
(Java classes)
I wanted to test flash sockets application (socketFileLoader).
Structure : in .fla source code defines a SmartFoxClient which sends message to server (sendXtMessage()). An java extension processes the request. Config.xml points to it, this file is loaded by SmartFoxClient (sloader part). Java processes ans sends response (sendResponse()).
Java class pointed is SocketFileLoader (which extends AbstractExtension).
But there is no ‘accessible’ package where you can find AbstractExtension, it’s in fact in jysfs.jar. If you want to modify SocketFileLoader, you must compile again after. It’s possible by command-line, but it’s also possible (and easier) with software like Eclipse ; classes are compiled by default at every save in bin directory.
config.xml
This file defines some parameters : IP, port server, blacklist of words… but also specific parameters for your application.
Zone markup : name is zone’s name which you send with SmartFoxClient.login().
Extensions markup defines extensions :
name (loader) matches to value you send in xtName with sendXtMessage(), className must point to ‘handling’ class in server side, and type is the type (java for java classes and script for actionscript classes).
If something is vague, incomplete or worse, don’t hesitate to tell me (:
Useful links :
smartfoxserver doc
smartfoxserver forum
where are the javaExtension classes?
gotoandplay.it tutorials[/lang_en]