Agilent Technologies E4406A VSA Series Programmer's Manual page 161

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

Advertisement

}
//
Socks class is responsible for open/close/read/write operations
//
from the predefined socket ports.
//
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
Socks(URL appletB)
{
appletBase = appletB;
// Set up for port array.
port[SCPI] = SCPI_PORT;
// Initialize the sock array
for ( int i = 0; i < MAX_NUM_OF_SOCKETS; i++ ) {
sock[i] = null;
sockIn[i] = null;
sockOut[i] = null;
sockOpen[i] = false;
}
}
//***** Sockects open/close routines
// Open the socket(s) if not already opened
public void OpenSockets()
{
try {
// Open each socket if possible
for ( int i = 0; i < MAX_NUM_OF_SOCKETS; i++ ) {
if ( !sockOpen[i] ) {
Chapter 3
sock[i] = new Socket(appletBase.getHost(),port[i]);
sockIn[i] = new DataInputStream(sock[i].getInputStream());
Using Java Programming Over Socket LAN
For this example program,
Programming Examples
161

Advertisement

Table of Contents
loading

Table of Contents