Single Socket Communications Protocol
This protocol plug-in module allows full, two-way, synchronous and asynchronous, multi-conversation communications over a single socket pair. It is primarily used when an IP connection may only be made in one direction but full duplex communications is required. This is the case with mobile phones where typically an IP call may only be made from the phone to an IP address but not from a host on the Internet to the phone.
The SSC protocol uses a client/server pattern to establish and maintain communication channels. A centralised server manages all the conversations which run between the various clients. The clients establish a single connection with the server and then all their communications is done over that link. Conversations may be established by one client to another by making a "connection" to the client by name. The server handles all the routing, and error handling transparently to the clients.
Sscomms.jar must be included in your classpath to use this protocol with Ponder2.
The server must be run separately from any application that utilises an SSC client. The server is started with the command:
1 java -jar sscomms.jar
This command will establish a server listening on port 8439, the sscomms default port. If you want to use another port, e.g. 1234 then you can use the -port argument like this:
1 java -jar sscomms.jar -port 1234
The server offers a command prompt on the screen for tracing and debugging purposes. Type "?" for help. You will be offered three commands, l, to list all the clients it knows about, t to toggle tracing on and off, t followed by a client name argument will trace all messages to or from that client.
Ponder2 uses the protocol name "ssc" for the |Single Socket Communications plug-in. It is used in the normal Ponder communications manner. For instance, one Ponder2 SMC can open an address and wait for other Ponder2 messages:
java -cp <jar files> net.ponder2.SelfManagedCell -address ssc://192.168.1.101:8439/client1
This command tells the Ponder2 communications system to load the SSC protocol and tells the protocol plugin that the SSC server is at 192.168.1.101 running on port 8439 and that this client will be known as "client1." If another client opens a connection to client1 then it can be done using PonderTalk in another Ponder2 SMC like this:
other root := import "root" from "ssc://192.168.1.101/client1".
Note, as with all Ponder2 communications, if the second SMC was not given a SSC address using the -address option then a unique client name will be generated when the protocol is loaded and opened. At least one Ponder2 SMC has to be given an address otherwise none of them will be able to communicate.