Agilent Technologies E4406A VSA manual Programming Examples, Using C Programming Over Socket LAN

Models: E4406A VSA

1 406
Download 406 pages 63.49 Kb
Page 152
Image 152
Manual background

Programming Examples

Using C Programming Over Socket LAN

WORD wVersionRequested;

WSADATA wsaData;

int err;

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.

*

This can be in dotted decimal notation.

*

(int) portNumber . . . . . . . The TCP/IP port to talk to.

152

Chapter 3

Page 152
Image 152
Agilent Technologies E4406A VSA manual Programming Examples, Using C Programming Over Socket LAN