server

From autoplot.org

Jump to: navigation, search

Audience: Software wishing to use Autoplot from other software packages.

Purpose: Outline the server interface

1. Introduction

Autoplot has a "server" mode where it is able to accept commands from a socket, and possibly send back graphics. The interface is just a Jython command line similar to that on the console tab, except that "telnet" can be used to connect. Similarly, IDL can be used to connect, for example to have Autoplot render data.

2. First Look

First, the server mode must be enabled. If Autoplot is already running, then this can be done with [menubar]->Options->Enable Server, then use 12345 for the port and hit OK. Now use telnet to experiment with the interface. For example:

spot5> telnet localhost 12345
Trying ::1...
Connected to localhost.
autoplot> plot( [1,2,3,4,5], title="My Data" )
autoplot> plot( 'http://autoplot.org/data/autoplot.cdf?Magnitude' )

The external software might format data then tell Autoplot to plot the data.

3. Advanced Details

It may be necessary for Autoplot to issue a newline after the prompt is sent, so that a client code can see that Autoplot is finished when buffering prevents this. This can be done by resetting the prompt property of ApplicationModel:

dom.controller.applicationModel.prompt='autoplot>\n'
Retrieved from "http://autoplot.org//server"
Personal tools