Entrainer Sockets (New in 3.0.0 Final)
Starting with version 3.0.0 of Entrainer an external interface has been added to the program. The purpose of this interface is to allow external programs and hardware to be made aware of the current state of Entrainer, and to allow external programs and hardware to control Entrainer's state. Clicking the 'Accept Connections' menu item will bind and unbind Entrainer to the host and port defined in its settings.
The interface is communicated through sockets, and
is an XML document. The specifics of the interface are located in the Javadoc and source for the class
Choosing the Socket Host and Port
Clicking the 'Choose Socket Port' menu item brings up the dialog to change the host, port and whether Entrainer communicates only changes to its state, or its entire state should any part of the state change. When first invoked Entrainer makes a best-guess at the host ip address of the machine on which it is running. This can be overridden to be the host name or another IP address identifying the machine.
The port setting defines on what port on the machine Entrainer creates its socket to accept external connections. The value of this field should be > 1000 (many ports < 1000 are used by your computer ie. port 80 for http, 443 for SSL etc) and must not be used by any other sockets on your machine. Should it be used by another socket an error will be generated on clicking the 'Accept Connections' menu item & another port will need to be set.
The Connector GUI
Clicking the 'Show Connector GUI' menu item brings up an instance of the Connector GUI. This frame mimics the behaviour of an external program connecting to Entrainer by receiving state change events from Entrainer, and provides control for a subset of Entrainer's functionality. It demonstrates Entrainer's socket functionality only and is not necessary for the normal use of Entrainer.
To use the Connector GUI Entrainer must be accepting connections on the host & port defined in the settings. Clicking the 'Connect' button on the Connector GUI will cause the Connector GUI to establish the socket connection. Entrainer, on connection, sends its current state to the 'external' program. The text area shows the messages received from Entrainer. Many instances of the Connector GUI can be created & connected to a single instance of Entrainer - Entrainer is capable of accepting multiple connections from external programs and hardware.