Agilent Technologies ES Switch User Manual


 
6-38 LAN Interface Supplement
Controlling the Analyzer via the LAN
Controlling the Analyzer with a Java™ Applet
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] ) {
sock[i] = new Socket(appletBase.getHost(),port[i]);
sockIn[i]=new DataInputStream(sock[i].getInputStream());
sockOut[i]=new PrintStream(sock[i].getOutputStream());
if ( (sock[i] != null) && (sockIn[i] != null) &&
(sockOut[i] != null) ) {
sockOpen[i] = true;