Specifications
Chapter 18 331
PSA Programming Examples
Using Java Programming Over Socket LAN
PSA Programming Examples
 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;
  }
  }
  }
  }
  catch (IOException e) {
   System.out.println("Sock, Open Error "+e.getMessage());










