Queries for lan using sockets – Agilent Technologies N5183A MXG User Manual

Page 117

Advertising
background image

Agilent N518xA, E8663B, E44x8C, and E82x7D Signal Generators Programming Guide

107

Programming Examples

LAN Programming Interface Examples

5.

After you cd to the directory where the lanio.exe file is located, type in the following command at
the command prompt: lanio xxxxx “*IDN?”. For example:
C:\SocketIO\Lanio\Debug>lanio xxxxx “*IDN?”

where the xxxxx is the hostname of your

signal generator. Use this format to output SCPI commands to the signal generator in a line by
line format from the command prompt.

6.

Type exit at the command prompt to quit the program.

Programming Using main1() Function

The int main1() function will output a sequence of commands in a program format. If you want to
run a program using a sequence of commands then perform the following:

1.

Enter the hostname of your signal generator in the openSocket function of the main1() function
of the lanio.cpp program.

2.

Rename the lanio.cpp int main1() function to int main() and the original int main() function
to int main1().

3.

Select

Rebuild All from Build menu. Then select Execute Lanio.exe.

The program will run and display results similar to those shown in

Figure 3- 2

.

Figure 3-2

Program Output Screen

Queries for Lan Using Sockets

lanio.c

and getopt.c perform the following functions:

establishes TCP/IP connection to port 5025

resultant file descriptor is used to “talk” to the instrument using regular socket I/O mechanisms

maps the desired hostname to an internal form

Advertising
This manual is related to the following products: