EasyManuals Logo
Home>HP>Measuring Instruments>16500C

HP 16500C Programmer's Guide

HP 16500C
252 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #65 background imageLoading...
Page #65 background image
Sending Commands to the HP 16500C Socket
If you are programming in C, you can use a socket to communicate with the
HP 16500 system. By opening a socket connection, you can send program
commands directly to the command parser. The HP 16500C system socket
port identification number is 5025.
You can also connect directly to the parser socket and type commands
directly to the HP 16500. The second example uses telnet to connect to the
parser socket.
Example The following C program opens a socket and sends a query to request the
instrument’s identity. If someone else is already connected as control user,
the socket will eventually close without receiving a response.
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
typedef struct sockaddr_in tdSOCKET_ADDR;
#define PARSER_PORT 5025
#define SERV_HOST_ADDR "15.10.96.12"
#define PARSER_BUFFER_SIZE 100
char receiveBuffer[PARSER_BUFFER_SIZE],
*cmdString = { "*IDN?\r\n" };
main ()
{
int sockfd,
port;
tdSOCKET_ADDR serv_addr;
char *addr;
/* Initialize a server socket */
port = PARSER_PORT;
addr = SERV_HOST_ADDR ;
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = inet_addr ( addr );
serv_addr.sin_port = htons ( port );
Programming Over LAN
Sending Commands to the HP 16500C Socket
4–11

Table of Contents

Other manuals for HP 16500C

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the HP 16500C and is the answer not in the manual?

HP 16500C Specifications

General IconGeneral
BrandHP
Model16500C
CategoryMeasuring Instruments
LanguageEnglish

Related product manuals