Keysight CXG, EXG, and MXG X-Series Signal Generators Programming Guide 151
Programming Examples
LAN Programming Interface Examples
4.
Compile the program. At the command prompt type:
javac
ScpiSockTest.java.
The directory path for the Java compiler must be specified. For example:
C:\>jdk1.3.0_02\bin\javac ScpiSockTest.java
5.
Run the program by typing
java ScpiSockTest
at the command
prompt.
6.
Type
exit
at the command prompt to end the program.
Generating a CW Signal Using Java
The following program example is available on the signal generator
Documentation CD-ROM as
javaex.txt
.
//*****************************************************************
// PROGRAM NAME: javaex.txt
// Sample
java program to talk to the signal generator via SCPI-over-sockets
// This program requires Java version 1.1 or later.
// Save this code as ScpiSockTest.java
// Compile by typing: javac ScpiSockTest.java
// Run by typing: java ScpiSockTest
// The signal generator is set for 1 GHz and queried for its id
string
//*****************************************************************
import java.io.*;
import java.net.*;
class ScpiSockTest
{
public static void main(String[] args)
{
String instrumentName = "xxxxx"; // Put instrument
hostname here
try
{
Socket t = new Socket(instrumentName,5025); // Connect to
instrument
//
Setup read/write mechanism
Summary of Contents for X-Series
Page 4: ...4 ...
Page 10: ...10 Contents ...