Another Message Exchange System

What is AMES:

  • It another message exchange system based on TCP/IP, XML, JSON and HTTP.
  • The primary use is communication between not more than 20000 clients.
  • It is a system where all the clients connects to a central server.
  • Each client is identified by a unique name.
  • The server routes messages between the clients allowing a client to send a message any other client.
  • Currently clients can communicate with the server using HTTP or a simple XML protocol.
  • The client implementation is kept as simple as possible.
  • The HTTP client use “smart polling” to ensure fast message transport with minimum network trafic.
  • A server implementation is available as freeware without source code.
  • The server is available as a Windows application with debugging support and as Windows dll for embedding into other applications. The Windows application can run on other OS using Wine.
  • Client implementations written in JavaScript, Director, Flash and Java are available as freeware with source code.
  • A client implementation as a dll for embedding into other applications also exist.


AMES is a easy to use communication system, that can work in most programming environments. To use AMES one PC running Windows is required for the server. The clients can run on many different platforms.

To see how it works follow this guide.

Step 1 : Get & Install AMES

AMES is freeware and can be downloaded from here.

The downloaded file is a zip archive. To install AMES unzip the archive to a folder on a PC running Windows 98, Windows 2000, Windows XP, Windows Vista or Windows 7. It is important to keep the folder structure of zip archive intact, most modern unzip applications will do this automatically.

It is possible to run the Ames server application on Unix and Mac OS. One option is to run the Ames server with Wine. Ames server has been tested and seems to work on Mac OS using the CrossOver version of Wine. Wine does not require a Windows license. The CrossOver version of Wine cost about 50 USD.

Lanuch the Ames10.exe application in the folder. This is the standalone server application.

  • NOTE: The first time the server is launched a firewall warning is often displayed. The server can only work if it is allowed to accept incoming TCP/IP connections.

The Ames server is configured to automatically startup when launched.

Step 2 : Try AMES from a Web Browser

The first thing to try is to send a message. To make it easy a message is sent from a client to itself. In a web browser (Internet Explorer, Google Chrome or any other) type in this URL:


The URL instructs AMES to send a “hello” message from client “me” to client “me” (the client sends a message to itself). The web browser should display:


Any other result means that something is not working. If there is a problem it is most likely:

  • That a firewall is blocking the AMES server from receiving incoming TCP/IP connections. If the PC running the AMES server is administered by an IT department, they may be the only people who can configure the firewall.
  • That another TCP/IP server is already listing on port 8000 or 8001. This is not a big problem, because AMES can be configured to use different ports. Read about it here.

If everything went as planned the following things has just happened:

  • The client “me” was created. The Ames server automatically created the client.
  • The client was connected to the server.
  • The client sent a message to itself.

To retrieve the message sent to the client. Enter the following URL in the web browser:


And the web browser should show:


To get a more readable result, copy this text and paste it into When reformatted the result looks like this:

        "from": "~",
        "msg": "connect",
        "detail": [
        "from": "me",
        "msg": "hello",
        "detail": [

Step 3 : Try the Advanced Version in a Web Browser

The AMES sever is not running on the same port as your HTTP server and it may also not be running on the same computer. This is a problem because the security model of a Web Browser does not allow AJAX requests from one domain to another. Some people at Google have found a workaround for this, and it is used in this example.

Inside the AMES folder there is a folder called “html” find this folder and follow these steps.

Step 1:
Lanuch the Ames10.exe application found in the Ames application folder. When the application is lanuched the first time you may get a firewall warning. Ames can only work if is allowed to accept incoming TCP/IP conncetions.

Step 2:
Open the chat.html file in Google Chrome, Internet Explorer, Apple Safari, or another browser. Please notice that the JavaScript has only been tested in Google Chrome, Internet Explorer and Apple Safari so far.

Step 3:
On the web page enter the address of the Ames server. If the browser is running on the same computer as the Ames server use “localhost” otherwise enter the IP address of the computer where Ames is running.

Step 4:
Enter a client name. It can be anything.

Step 5:
Type som text in the “outgoing” text area. The text should be mirrored in the topmost text area called “incomming”.

Step 6:
Repeat step 2 to 5 one or more times on the same or on a different computer. Any text entered in one browser windows should be mirroed in all of the other windows.

Step 7:
Also check out the information displayed in the Ames server. Here you can see the messages passed on between the different clients.

Step 4 : Try the Java or Flash Version

Smart Polling

In the HTTP protocol the client must initiate communication with the server. When the server has a message for the client it can not deliver it to the client unless the client request it. Therefore the client must “poll” the server by periodically asking the server if the is a new message. The polling has two disadvantages:

  • A new message is only received when the client ask for it. If the client ask every second messages may be delayed a second before they are received.
  • The client generate network trafic even when there is no new messages.

These two disadvantages can be minimized by making server and client a little more advanced. Here is how:

  • When the client ask for a new message the server wait until a new message is ready before it replies the request.
  • To avoid that the web browsers timeout the request, the server must reply after some time even if there is no new message.
  • When the client gets the reply it must send a new request to keep the loop going.
  • Since most browsers “keep-alive” connections to serves the loop will be very efficient - minimal trafic, minimal number of new socket connections.