
Annex
NRP2
365
User Manual 1173.9140.02 ─ 07
**
** MODULE ETHERNET.C
**
** PROJECT NRP2
**
** COMPILER ...
**
** LANGUAGE ANSI-C
**
** DATE 28.02.2001
**
** AUTHOR R & S
**
** ABSTRACT Demonstration of controlling the NRP2 over Ethernet
** with the WinSocket interface.
**
** DESCRIPTION Initialize the WinSock interface
**
Connecting Link1 (TCP/IP).
**
Connecting Link2 (TCP/IP).
**
Sending the SCPI common command *sre 0
**
Sending the SCPI common command *idn?
**
Close Link2
**
Close Link1
**
*************************************************************************
************************************************************************/
/* INCLUDE FILES *******************************************************/
#include <stdio.h>
#include <winsock2.h>
/* LOCAL DEFINES *******************************************************/
#define IP_ADDR "192.168.1.2" // IP address of NRP2
#define PORT_NO 3000 // Port number of NRP2
#define MAX_RECV 200 // Max response len
/* MAIN FUNCTION *******************************************************/
int main(int argc, char* argv[])
{
int
nRet;
WSADATA
wsaData;
SOCKET
soLink1;
SOCKET
soLink2;
SOCKADDR_IN saDevice;
char
ResponseMessage[MAX_RECV];
WORD
wVersionRequired = MAKEWORD(2,2);
//-----------------------
// Initialize WinSocket
//-----------------------
nRet = WSAStartup(wVersionRequired, &wsaData);
if (nRet)
{
Remote control interfaces
北京海洋兴业科技股份有限公司(证券代码:839145)
电话:010-62176775
网址:www.hyxyyq.com