Agilent Technologies E8663B Portable Generator User Manual


 
122 Agilent N518xA, E8663B, E44x8C, and E82x7D Signal Generators Programming Guide
Programming Examples
LAN Programming Interface Examples
/******************************************************
/* open a socket connection to the instrument
/******************************************************/
#ifdef WINSOCK
if (init_winsock() != 0) {
exit(1);
}
#endif /* WINSOCK */
instSock = openSocket(destination, SCPI_PORT);
if (instSock == INVALID_SOCKET) {
fprintf(stderr, "Unable to open socket.\n");
return 1;
}
/* fprintf(stderr, "Socket opened.\n"); */
if (strlen(command) > 0)
{
/*******************************************************
/* if the command has a '?' in it, use queryInstrument. */
/* otherwise, simply send the command. */
/*******************************************************/
if ( isQuery(command) )
{
long bufBytes;
bufBytes = queryInstrument(instSock, command,
charBuf, INPUT_BUF_SIZE);
if (!quiet)
{
fwrite(charBuf, bufBytes, 1, stdout);
fwrite("\n", 1, 1, stdout) ;
fflush(stdout);
}
}
else
{
commandInstrument(instSock, command);
}
}
else
{