162
Chapter 3
Programming Examples
Using Java Programming Over Socket LAN
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());
}
}
// Close the socket(s) if opened
public void CloseSocket(int s)
{
try {
if ( sockOpen[s] == true ) {
// write blank line to exit servers elegantly
sockOut[s].println();
sockOut[s].flush();
sockIn[s].close();
sockOut[s].close();
sock[s].close();
sockOpen[s] = false;
}
}
catch (IOException e) {
System.out.println("Sock, Close Error "+e.getMessage());
}
}
// Close all sockets
public void CloseSockets()
{
for ( int i=0; i < MAX_NUM_OF_SOCKETS; i++ ) {
CloseSocket(i);
}
}
// Return the status of the socket, open or close.
public boolean SockOpen(int s)
{
return sockOpen[s];
}
//************* Socket I/O routines.
//*** I/O routines for SCPI socket
// Write an ASCII string with carriage return to SCPI socket
public void ScpiWriteLine(String command)
Summary of Contents for E4406A VSA Series
Page 4: ...4 ...
Page 59: ...59 2 Programming Fundamentals ...
Page 124: ...124 Chapter2 Programming Fundamentals Using the LAN to Control the Analyzer ...
Page 125: ...125 3 Programming Examples ...
Page 164: ...164 Chapter3 Programming Examples Using Java Programming Over Socket LAN ...
Page 165: ...165 4 Programming Command Cross References ...
Page 379: ...379 6 Error Messages ...
Page 412: ...412 Chapter6 Error Messages Error Message Descriptions ...