Keysight E4428C ESG RF Programming Manual page 136

Signal generators
Table of Contents

Advertisement

Programming Examples
LAN Programming Interface Examples
*
* $Parameters:
$
*
(const char *) hostname . . . . Network name of instrument.
*
*
(int) portNumber
*
*
* $Return:
(int)
*
* $Errors:
returns -1 if anything goes wrong $
*
***************************************************************************/
SOCKET openSocket(const char *hostname, int portNumber)
{
struct hostent *hostPtr;
struct sockaddr_in peeraddr_in;
SOCKET s;
memset(&peeraddr_in, 0, sizeof(struct sockaddr_in));
/***********************************************/
/* map the desired host name to internal form. */
/***********************************************/
hostPtr = gethostbyname(hostname);
if (hostPtr == NULL)
{
fprintf(stderr,"unable to resolve hostname '%s'\n", hostname);
return INVALID_SOCKET;
}
/*******************/
/* create a socket */
/*******************/
s = socket(AF_INET, SOCK_STREAM, 0);
if (s == INVALID_SOCKET)
{
fprintf(stderr,"unable to create socket to '%s': %s\n",
hostname, strerror(errno));
return INVALID_SOCKET;
}
128
This can be in dotted decimal notation.
. . . . . . . The TCP/IP port to talk to.
Use 5025 for the SCPI port.
. . . . . . . . A file descriptor similar to open(1).$
Keysight Signal Generators Programming Guide

Advertisement

Table of Contents
loading

Table of Contents