[SmartFox] Introduction to SmartFoxServer Lite
[ August 10, 2004 ] by Marco Lapi, a.k.a Lapo
Article 1: an introductory article on how to use and configure SmartFoxServer Lite before diving into the example applications.

In this introductory article I'd like to give you an overview on how to use SmartFoxServer Lite and the examples files that you will find in the software package.

Before proceeding there are some requirements that should be met:

1) You should already have a basic understanding of client-server interaction with Flash and socket connections.
I've already written an introductory article on sockets and Flash and you may want to read it before diving into more complex stuff.

2) You should have downloaded and installed the SmartFoxServer Lite package for your operating system.
If you didn't please go to our download section.

3) You should have already read the SmartFoxServer Lite installation notes for your operating system.

The server is configured by default to work on your local machine by listening for connections on port 9339 at the (localhost) address.

This is the simplest way to use the server as you don't have to use separate machines for server and clients.
Once the server is started you will able to launch the sample applications and start playing with them.

This is what you should see when you first launch the server:

The server boot output is mainly made up of three sections:

1) A generic system report:
This section can be very important for bug reports: if you find any bug you should always report it in the forums together
with this server output. It will help us better understand what is going on.

2) Zones & Rooms:
Zones are "virtual areas" of the server were applications run. You can have as many applications running simultaneously on the server and each one will have its own Zone name. (i.e. a game, a chat, a whiteboard ...)
At startup the server shows which zones are created and which rooms they contain.

3) Server running:
The last part logs the activity of the server. When your clients will connect to the server you will receive messages of their activity. Each message shows the time in which the event occurred and it's priority followed by the server message.

The most important log levels are:

[ INFO ]: a simple server notification
[ WARNING ]: this server message may require some attention.
[ SEVERE ]: this server message requires attention. An important exception was caught. In some special cases the server may stop responding after one of these errors.

The log messages are also saved to text files in the SmartFoxServer Lite/Server/logs/ folder

The configuration of the server is done through an xml file called config.xml and located in the SmartFxServerLite/Server/ folder

The default config file looks like this:





     <Zone name="simpleChat">
         <Room name="The Hall" maxUsers="50" isPrivate="false" isTemp="false" autoJoin="true" />
         <Room name="The Kitchen" maxUsers="50" isPrivate="false" isTemp="false" />
         <Room name="The Garden" maxUsers="50" isPrivate="false" isTemp="false" />
         <Room name="The Bathroom" maxUsers="50" isPrivate="false" isTemp="false" />
         <Room name="The Garage" maxUsers="50" isPrivate="false" isTemp="false" />
         <Room name="The Living Room" maxUsers="50" isPrivate="true" isTemp="false" pwd="hello" />
     <Zone name="sftris">
         <Room name="The Entrance" maxUsers="50" isPrivate="false" isTemp="false" autoJoin="true"/>


The <ServerSetup></ServerSetup> section contains all the basic startup parameters for the server:

» ServerIP: ip address
» ServerPort: the listening port
» MaxUserIdleTime: the maximum idle time for a client, expressed in seconds. By default all users that have been idle for more than 600 seconds (10 mins) are automatically disconnected.
» MsgMaxLen: the max amount of bytes for an incoming message. By deafult it is set to 2000. All messages exceeding this size are discarded.
» LogMaxSize: The maximum size of a log file before it is "rotated". ( A new one is started )
» LogMaxFiles: The maxmimum number of log files

The <Zones></Zones> section is where you define the applications that will run on the server and the rooms that they will contain.
Every zone should have a unique name and a list of rooms. Also each room has its own properties:

» name: the room name. No duplicates are allowed within the same zone
» maxUsers: the capacity of the room (each room can contain from a min. of 2 to a max. of 50 users)
» isPrivate: a flag that tells if the room is password protected
» pwd: a case-sensitive password for the room
» isTemp: a flag that tells if the room is "temporary". This feature is discussed in detail in the Advanced Chat tutorial
» isGame: a flag for turning a room into a "game room". This feature is discussed in detail in the Board Game tutorial
» autoJoin: when set to "true" the room is automatically joined when a user logs in the zone

All the example application sources are located in the SmartFoxServerLite/Examples/ folder.
In order to learn all the concepts in our tutorials we highly reccomended that you follow the articles in the order in which they are presented. Each lessons builds on the previously acquired knowledge, hence the importance of following them in the right sequence.


Name: Marco Lapi, a.k.a Lapo
Location: Fossano, Italy
Age: 34
Flash experience: started out with Flash 4 back in 1999
Job: web designer/developer
Website: http://www.gotoandplay.it/
| Homepage | News | Games | Articles | Multiplayer Central | Reviews | Spotlight | Forums | Info | Links | Contact us | Advertise | Credits |

| www.smartfoxserver.com | www.gotoandplay.biz | www.openspace-engine.com |

gotoAndPlay() v 3.0.0 -- (c)2003-2008 gotoAndPlay() Team -- P.IVA 03121770048