Using Java Programming Over Socket Lan; Example - Agilent Technologies E4406A VSA Series Programmer's Manual

Transmitter tester
Hide thumbs Also See for E4406A VSA Series:
Table of Contents

Advertisement

Programming Examples

Using Java Programming Over Socket LAN

Using Java Programming Over Socket LAN
This is a Java programming example (ScpiDemo.java) that
demonstrates simple socket programming with Java. It is written in
Java programming language, and will compile with Java compilers
versions 1.0 and above.

Example:

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
// E4406A VSA
with a JAVA capable browser.
// Main class for the SCPI Demo.
// 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.
// Socks.class and ScpiDemo.html to a floppy.
// your instrument.
// following:
//
1. Load this URL in your browser:
//
ftp://<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.
//
to enter a SCPI command.
//
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);
Panel
southPanel = new Panel();
Panel
p;
// Initialize the applets
public void init() {
SetupSockets();
SetupPanels();
// Set up font type for both panels
Font font = new Font("TimesRoman", Font.BOLD,14);
scpiResponse.setFont(font);
126
This applet will need Socks.class to
Load up a browser on your computer and do the
Type in a SCPI command and hit enter.
This is the
copy ScpiDemo.class,
Insert the floppy into
The bottom one is for you
Chapter 3

Advertisement

Table of Contents
loading

Table of Contents