
142
Chapter 3
Programming Examples
Using C Programming Over Socket LAN
* Query X and Y values of marker 1 and marker 2 (assumes they are on):
* lanio my4406 'calc:spec:mark1:x?;y?; :calc:spec:mark2:x?;y?'
*
* Check for errors (gets one error):
* lanio my4406 'syst:err?'
*
* Send a list of commands from a file, and number them:
* cat scpi_cmds | lanio -n my4406
*
****************************************************************************
*
* This program compiles and runs under
* - HP-UX 10.20 (UNIX), using HP cc or gcc:
* + cc -Aa -O -o lanio lanio.c
* + gcc -Wall -O -o lanio lanio.c
*
* - Windows 95, using Microsoft Visual C++ 4.0 Standard Edition
* - Windows NT 3.51, using Microsoft Visual C++ 4.0
* + Be sure to add WSOCK32.LIB to your list of libraries!
* + Compile both lanio.c and getopt.c
* + Consider re-naming the files to lanio.cpp and getopt.cpp
*
* Considerations:
* - On UNIX systems, file I/O can be used on network sockets.
* This makes programming very convenient, since routines like
* getc(), fgets(), fscanf() and fprintf() can be used. These
* routines typically use the lower level read() and write() calls.
*
* - In the Windows environment, file operations such as read(), write(),
* and close() cannot be assumed to work correctly when applied to
* sockets. Instead, the functions send() and recv() MUST be used.
*/
/* Support both Win32 and HP-UX UNIX environment */
#ifdef _WIN32 /* Visual C++ 4.0 will define this */
# define WINSOCK
#endif
#ifndef WINSOCK
# ifndef _HPUX_SOURCE
# define _HPUX_SOURCE
# endif
#endif
#include <stdio.h> /* for fprintf and NULL */
#include <string.h> /* for memcpy and memset */
#include <stdlib.h> /* for malloc(), atol() */
#include <errno.h> /* for strerror */
#ifdef WINSOCK
#include <windows.h>
Содержание E4406A VSA Series
Страница 4: ...4 ...
Страница 59: ...59 2 Programming Fundamentals ...
Страница 76: ...76 Chapter2 Programming Fundamentals Using the Instrument Status Registers Overall Status Register System ...
Страница 124: ...124 Chapter2 Programming Fundamentals Using the LAN to Control the Analyzer ...
Страница 125: ...125 3 Programming Examples ...
Страница 164: ...164 Chapter3 Programming Examples Using Java Programming Over Socket LAN ...
Страница 165: ...165 4 Programming Command Cross References ...
Страница 379: ...379 6 Error Messages ...
Страница 412: ...412 Chapter6 Error Messages Error Message Descriptions ...