Agilent Technologies E4406A VSA Satellite Radio User Manual


 
Chapter 3 175
Programming Examples
Using Java Programming Over Socket LAN
p.add("West", new Label("SCPI command:"));
p.add("Center", scpiCommand);
southPanel.add(p);
// Set up the Response panel
setLayout(new BorderLayout(2,2));
add("Center", scpiResponse);
add("South", southPanel);
}
}
// Socks class is responsible for open/close/read/write operations
// from the predefined socket ports. For this example program,
// the only port used is 5025 for the SCPI port.
class Socks extends java.applet.Applet {
// Socket Info
// To add a new socket, add a constant here, change MAX_NUM_OF_SOCKETS
// then, edit the constructor for the new socket.
public final int SCPI=0;
private final int MAX_NUM_OF_SOCKETS=1;
// Port number
// 5025 is the dedicated port number for E4406A Scpi Port
private final int SCPI_PORT = 5025;
// Socket info
private URL appletBase;
private Socket[] sock = new Socket[MAX_NUM_OF_SOCKETS];
private DataInputStream[] sockIn = new DataInputStream[MAX_NUM_OF_SOCKETS];
private PrintStream[] sockOut = new PrintStream[MAX_NUM_OF_SOCKETS];
private int[] port = new int[MAX_NUM_OF_SOCKETS];
private boolean[] sockOpen = new boolean[MAX_NUM_OF_SOCKETS];
// Constructor