The Java Socket Server
for Linux or Windows

Return to Index

If you're reading this, then FlashChat is installed on your web server, but without the socket server option enabled. If it's not installed, stop reading this and install it.

To run the Java socket server correctly the following is required:

To download the latest version of Java point your browser at:

For more information about Java programming and Java development, please visit:

If you are familiar with the php socket server installation for the most part it is the same as the JavaServer, however PHP does not need to be compiled with the socket extensions.

STEP 1: OPEN /inc/config.php

Open the /inc/config.php file with a good text editor. Please do not use HTML wysiwyg editors or MS Windows editors, since they sometimes add characters to PHP files that could prevent correct PHP execution. For Linux/Unix systems it is suggested to use pico, vi, or emacs. For Windows, Textpad is a good editor.

The following two lines need to be changed:

'enableSocketServer' => false,
'javaSocketServer' => false,

After you're done editing they should look like the lines below:

'enableSocketServer' => true,
'javaSocketServer' => true,

NOTE: FlashChat has TWO different types of the socket server: a Java socket server, and a PHP (non-Java) socket server. For the Java socket server, you must have both of these config.php options set to true. If you only set "enableSocketServer" to true, you are effectively only enabling the PHP version of the socket server, which although not as robust as the Java version, may be useful to some users who do not have Java available.

The steps for enabling the PHP socket server are somewhat different than those for the Java socket server.


To configure the Java Socket Server locate the /inc/javaServer directory and edit the config.socketSrv.php file.

You must set the correct domain (http://...) on which FlashChat is to be used, and set the correct Java classpath.

Example for the domain:

                $GLOBALS['fc_config']['socketServer'] = array(
                         'host' => '', 
                         'port' => '9090',  
                         'max_clients' => 100,  
                         'debug_mode'  => 'text', 
                         'log_file'    => 'socketServer.log'  

NOTE: If FlashChat is loaded from, then the 'host' parameter in config.socketSrv.php should be '', however if is used, then the 'host' parameter would be ''. In other words, your host value may differ based on whether you start FlashChat from a "www" domain.

Be sure that the port that you specify is not blocked by a firewall.


    - open /inc/javaServer/start.bat, and change the paths as appropriate
    - run "start.bat" by double-clicking it or starting it from the command prompt (type "start.bat" at the Windows command prompt from the /inc/javaServer/ directory)

    - open /inc/javaServer/startServer, and change the paths as appropriate
    - run startServer from the command line (type "./startServer" at the Linux command prompt from the /inc/javaServer/ directory)


That's all! You should be able to refresh FlashChat, and login using the socket server. This will enable you to have dozens, maybe hundreds, of chatters without overloading your server.

Please check /inc/javaServer/socketServer.log or /inc/javaServer/log.txt for any errors. The log.txt files are only populated with data if the 'errorReports' option is set to 'true' in /inc/config.php. It is recommended that you leave this to 'false' unless you need to debug your FlashChat setup.


If you require the Java source code (.java files), they are being offered for sale for just $5 at:

Most (99.9%) of users will not need these sources, however. We're making them available for those users who wish to perform advanced integration with their web system, and who are familiar with Java programming. For basic operation of the Java socket server with FlashChat, they are NOT needed. I hope it doesn't seem too greedy to sell these separately... the developmental costs for the Java socket server were rather high.


Special thanks to Andriy and Taras of the RuAnSoft development team for their coding prowess, and Kelly, Gene, and the other moderators and testers for their testing assistance.

I strongly welcome feedback on the Java socket server for FlashChat, especially if that feedback is accompanied by improvements to the source code or suggestion for making the code more secure or more reliable.

Please email any suggestions to, or post on the forum:

Thanks for using FlashChat!