LAN Interface Supplement 6-33
Controlling the Analyzer via the LAN
Controlling the Analyzer with a Java™ Applet
Controlling the Analyzer with a Java™
Applet
The following example program demonstrates simple socket
programming with Java. It is written in Java programming language,
and will compile with Java compilers versions 1.0 and above.
This program is on the Example Programs Disk that was shipped with
your analyzer. Please read the README file on the Example Programs
Disk before using this program.
import java.awt.*;
import java.io.*;
import java.net.*;
import java.applet.*;
// This is a SCPI Demo to demonstrate how one can communicate with the
// HP87xx network analyzer with a JAVA capable browser. This is the
// Main class for the SCPI Demo. This applet will need Socks.class to
// support the I/O commands and a ScpiDemo.html for a browser to load
// the applet.
// To use this applet, either compile this applet with a Java compiler
// or use the existing compiled classes. copy ScpiDemo.class,
// Socks.class and ScpiDemo.html to a floppy. Insert the floppy into
// your instrument. Load up a browser on your computer and do the
// following:
// 1. Load this URL in your browser:
// http://<Your instrument's IP address or name>/int/ScpiDemo.html
// 2. There should be two text windows show up in the browser:
// The top one is the SCPI response text area for any response
// coming back from the instrument. The bottom one is for you
// to enter a SCPI command. Type in a SCPI command and hit enter.
// If the command expects a response, it will show up in the top
// window.
public class ScpiDemo extends java.applet.Applet implements Runnable {
Thread responseThread;
Socks sck;
URL appletBase;
TextField scpiCommand = new TextField();
TextArea scpiResponse = new TextArea(10, 60);