Get OpenRDK at Fast, secure and Free Open Source software downloads

edit SideBar

Using the "simple" TCP interface

In this section, we will allow you to have a simple text-based access to the repository, using a TCP connection. The first you have to do is to add the module SimpleTcpInterfaceModule to the configuration file of the agent you want to access to.

You can use this module also if you need basic access to a running RAgent or RConsole from an external program.

This module allows bare-bone access to the repository: the client can read or set property values by specifying their path.

The SimpleTcpInterfaceModule on the agent acts as a server, you can use any program that allows text-based input-output to a TCP connection, e.g., telnet. For example, put an instance of the SimpleTcpInterfaceModule in the configuration example configuration file of the string writer ra-stringWriter.config.

Running the agent will start the simple TCP interface server, that will listen on port 9876 (the port can be changed using a property of the module). Only one client can connect at a time. When the client closes the connection, the module starts waiting for the next one.

Using telnet

If you open another console and start telnet, for example:

  $ telnet 9876

you are connected with the repository and you can read and write property values. Commands are given to the server as newline-terminated strings:

Command syntaxAnswerEffect
helplist of supported commandsprints the list of supported commands
getValue <URL>VALUE-OF: <URL> <value>returns the value of the specified property
setValue <URL> <value>VALUE-OF: <URL> <value>sets the value of the specified property
propertyListALL-PROPERTIES: <number>returns a list of all the properties, each on a single line
propertyList <prefix>PROPERTIES-WITH-PREFIX: <prefix> <number>returns a list of all the properties starting with prefix, each on a single line
getImage <URL> <format>IMAGE-VALUE-OF: <URL> <format> <size>retrieves an image (format can be jpeg, jpg, rdk); image data follows
getMap <URL> <format>MAP-VALUE-OF: <URL> <format> <size>retrieves a map image (format can be jpeg, jpg, rdk); image data follows

All commands may return an error message. All error messages start with the word "ERROR".

Using rdk-simpletcpclient

As an alternative to telnet you can use the rdk-simpletcpclient, provided by OpenRDK. It works basically like telnet, but when you ask for an image or a map, it will show it using ImageMagick (that need to be installed for this feature to work).

© 2004-2009 RoCoCo Laboratory Powered by PmWiki
Edit - History - Printable View - Recent Changes - Search
Page last modified on January 22, 2009, at 11:33 AM