Categories
HowTo's

#VSCP Howto: Linking server interfaces

The tcp/ip interface

This howto describes linking of VSCP server interfaces. With a server  interface we mean the VSCP tcp/ip control interface and especially the the VSCP link interface which is the required  tcp/ip commands that all VSCP nodes exporting a VSCP interface must make available. You find the full list here.

A VSCP server has an extended command set that can handle many special task needed on a full server. An embedded node however often just need the more limited set of commands but can of course add any other commands it like to export available if needed.

Why link servers

Why link servers one may ask. There can be many reasons for this Security can be one. You may link a VSCP server to a higher end server with just event going upwards not downwards and by that  prevent security threats as it will be impossible for the upward server to send events to the lower server. A typical scenario fr this is a server that show public data to an audience but where the source for the data is a real world system.

You maybe also just want to collect events from many subnets on a higher end server or some type of events on a special server.

Even more common is connections with lower end nodes that implement the tcp/ip interface and where you want to contact them from a server, to collect data, configure, control, instead  of the other way around.

How

There are many ways to do this. You can make a special driver. Make JavaScript or Lua scripts that handle this. Build your own application that acts as middleware. But there are of course read made tools available to.

If you want a connection from/to a remote node that is always active, yes it will be maintained, automatically bring up the link if it falls, the tcp/ip link driver is the solution. It lets you set up a link between two machines where one is a VSCP server and where the other machine also can also be a VSCP server but more usually is a lower end node exporting a VSCP tcp/ip interface.  The driver is extremely simple to use. Just add it, setup user connection data and set filters for outgoing and incoming events.  The tcp/ip link driver is described in full detail here. 

If you need to share a smaller selection of events with a remote node or just want to send events to a remote node when special things happen, or just want to filter events very hard, the decision matrix has an action that let you send events to a tcp/ip remote link interface.

Send event to remote host action

Its is the

VSCP_DAEMON_ACTION_CODE_SEND_TO_REMOTE    0x43/67

action that is used for remote connections. A typical DM entry looks like this

<row enable="true" groupid="send_remote_test" >

<comment>
 Test action send event
 </comment>

<mask priority="0"
 class="0xFFFF"
 type="0xFFFF"
 GUID=" 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00" />

<filter priority="0"
 class="10"
 type="6"
 GUID=" 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00" />

<action>0x43</action>
 <param>
 192.168.1.6;9598;admin;secret;%event
 </param>

<index measurementindex="true">1</index>

 </row>

Here the  temperature event that triggers the action is sent to a remote server (%event). You can of course set up to send any event you like or send an event that is stored in a variable.

This action is described here.

A connection is opened and closed each time an event is sent so the driver is much more efficient to use for setups where a lot of events should be sent to a remote location.  The actual transfer is on its own thread so timing is pretty constant also for a slow remote connection.

 

 

One reply on “#VSCP Howto: Linking server interfaces”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.