A Connector Class

Connector class: This class is for connecting to the universal Internet Message Switcher (IMS) to support rudimentary internet communication, for example to play blackjack or tic-tac-toe across the internet. The source code for the connector class is here. It is an abstract class and needs to be extended to work (see the example below). The extending class needs to implement the run method.

IMS Server: The Connector class uses a very simple protocol that is understood by the IMS server which is given here. To run the server use:

   java Server
from the command line (invoke run->cmd in Windows).

IMS protocol: The IMS server understands 20 ids, numbered 1-20, and associates a 'handle' with each due to a required opening 'connection' message from a client which looks, for example, like this:

    1 franco
or this
    2 peter
that is, id number followed by handle. From then on all messages begin with a destination id, an origin id, and the text that represents the message. For example, a message from peter to franco might look like this:
    1 2 This is a test
The server merely echoes the message to the destination id indicated by the first number and inserts the handle of the sender after the sender's id. Thus, the above message, as seen by franco, is
    1 2 peter This is a test
When franco receives the message, the second number (in this case 2) may be used to send a response message and the third number (in this case peter) may be used to enhance the display of the message.

Example: An example use of the Connector class is an IM client, the source code for which is here. Two html files for running this code are as follows:

   <applet code=IM.class width="500" height="300">
   <param name=myid value="1">
   <param name=name value="franco">
   <applet code=IM.class width="500" height="300">
   <param name=myid value="2">
   <param name=name value="peter">