Socket Server FAQ

Return to Index

Why do we need screen (Linux/UNIX only)?

Screen is used to detach the PHP/Java socket server from the shell you are currently using. It is essentially a way of creating a daemon without having to code it.

If you cannot install screen or do not want to use it, it is up to you. The following are ways to start both the PHP server and the Java server without screen - i.e. without the provided start scripts.

PHP Server:


php -q runServer.php

Java Server:


java "http://yourserver/chat/"

You may notice once you end your SSH session (logging off with putty) your session may hang. This is because you are still running the server attached to your current shell. With screen this would not happen.

How do I know my server is running?

Assuming you have SSH access to your server you can check to see if your server is running with the following commands.

PHP Server:

ps auxwww | grep -i screen

Depending on the processes running, you may see a bunch of lines. The line you are looking for is:

expected output:
scz   11782  0.0  0.1   3928   948 ?      Ss   15:42   0:00 SCREEN -A -m -d /usr/bin/php -q ./runServer.php

If you do not see this, the PHP server is not correctly running. Please refer to the PHP Socket Server documentation to ensure that all steps have been correctly completed.

Java Socket Server:

ps auxww | grep java

*Note: You may see multiple java processes that look similar, which is normal.

expected output:
scz   12771  0.3  1.6 261212 12460 pts/0    Sl   15:47   0:00 java

How can I see if the server is accepting connections?

A quick way to see if the socket server is running correctly is to telnet to the port that it should be on. The default port is 9090. This command (exactly as shown below) will work on both Windows and Linux/UNIX servers. If using Windows, use Start -> Run, then input "cmd" to open the command prompt.

telnet 9090

If the connection is refused the server is not accepting connections on that port, however if a box opens where you can type commands to your server, then we know that the port is open.

If you are trying to connect with a different system you may have port forwarding issues. To make sure this is not the case please refer to your router/firewall manual to see how to forward ports. If you can't find your manual you may try this resource:

Incorrect HTTP path to FlashChat installed folder

You may get an error that looks similar to the following when using the Java socket server:


Cant save log file: null
Incorrect HTTP path to FlashChat installed folder.

This can happen for a number of reasons:

1: You do not have both settings set for the Socket server in the config.php file.

Your chat/inc/config.php file should have both of these options set (Java socket server only!):

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

2: When starting the Socket server you are not referencing the correct URL.

If your root directory for http documents is /htdocs and FlashChat is installed in the chat directory, the Java socket server should be started as follows:

java "http://yourserver/chat/"

3: You are referencing the correct URL but mod_rewrite is changing the URL and the server is not able to find the correct chat location.

This occurs when you use Apache's mod_rewrite module. To see if this is the issue remove your mod_rewrite rules and try again. If it starts you need to reference the url differently via the Socket server start so that the url gets rewritten correctly, or use mod_rewrite only in directories needed and not for the whole server.

Exception in thread "main" java.lang.NoClassDefFoundError:

An error like the following can appear if you do not have an official Java version installed:


Exception in thread "main" java.lang.NoClassDefFoundError: at
at _Jv_ThreadRun(java.lang.Thread) (/usr/lib/
at _Jv_RunMain(java.lang.Class, byte const, int, byte const, boolean)
at __gcj_personality_v0
at __libc_start_main (/lib/tls/
at _Jv_RegisterClasses

This is fixed by downloading and installing the latest Java JRE from Sun. This particular version of Java being used is GCJ which is GNU's Java Implementation.

Thanks for using the FlashChat socket server!