Agilent Technologies E4406A VSA Series Programmer's Manual page 144

Transmitter tester
Hide thumbs Also See for E4406A VSA Series:
Table of Contents

Advertisement

Programming Examples
Using C Programming Over Socket LAN
wVersionRequested = MAKEWORD(1, 1);
wVersionRequested = MAKEWORD(2, 0);
err = WSAStartup(wVersionRequested, &wsaData);
if (err != 0) {
/* Tell the user that we couldn't find a useable */
/* winsock.dll.
fprintf(stderr, "Cannot initialize Winsock 1.1.\n");
return -1;
}
return 0;
}
int close_winsock(void)
{
WSACleanup();
return 0;
}
#endif /* WINSOCK */
/***************************************************************************
*
> $Function: openSocket$
*
* $Description:
open a TCP/IP socket connection to the instrument $
*
* $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);
144
*/
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).$
Chapter 3

Advertisement

Table of Contents
loading

Table of Contents