Agilent Technologies E4406A VSA Satellite Radio User Manual


 
178 Chapter 3
Programming Examples
Using Java Programming Over Socket LAN
//************* 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)
{
if ( SockOpen(SCPI) ) {
sockOut[SCPI].println(command);
sockOut[SCPI].flush();
}
}
// Read an ASCII string, terminated with carriage return from SCPI socket
public String ScpiReadLine()
{
try {
if ( SockOpen(SCPI) ) {
return sockIn[SCPI].readLine();
}
}
catch (IOException e) {
System.out.println("Scpi Read Line Error "+e.getMessage());
}
return null;
}
// Read a byte from SCPI socket
public byte ScpiReadByte()
{
try {
if ( SockOpen(SCPI) ) {
return sockIn[SCPI].readByte();
}
}