Connecting to External TCP Streams

To demonstrate the TCP stream Datasource in action we will try connecting to an publically accesible external TCP stream. To do this we must first install a separate instance of the Connector service and run it in a console.

To do this:

  1. Create a new directory in the desired location on your machine (for instance on the C: drive alongside the inmation.root folder, named connector2).

  2. Copy the "bin" directory from the original "inmation.root" directory where system:inmation was first installed on the machine.

  3. Open a command prompt window from the new "bin" directory (or navigate there in the command prompt) and enter a command using the following format: inmation.exe -e [Component] --instance [InstanceName] --port [Port]

For example: inmation.exe -e Connector --instance Connector2 --port 5100

This will launch a Connector service (instance name Connector2) running in Console mode.

Connector2 Running in Console Mode
Figure 1. Connector2 Running in Console Mode

Return to DataStudio and create a second Connector named Connector2 under the Core. In the communication settings give the hostname as localhost and set the port to the same one used when launching the Connector in console mode (for example, 5100). Once cretewd the Connector should be connected and visible in the I/O model.

Connector2 in the I/O Model
Figure 2. Connector2 in the I/O Model

Create a new Datasource under Connector 2 and change the server type to Generic TCP Stream. Enter the remote hostname as towel.blinkenlights.nl and set the Port number to 23.

Hostname and Port Settings for new TCP Stream Datasource
Figure 3. Hostname and Port Settings for new TCP Stream Datasource

In the Lua Script Body of the Datasource enter the following script:

return { received = function(data) print('recvd: ', data) end, }

In this script we return a table that only invokes the received callback function. Once the new TCP Datasource is created it should go green in the I/O Model indicating that it has connected to the TCP stream.

External TCP Datasource Connected in I/O Model
Figure 4. External TCP Datasource Connected in I/O Model

Now, return to the Console window and see the data received from the configured TCP source streaming. Enjoy the Movie!

Data Streaming in Console Window
Figure 5. Data Streaming in Console Window