EasyManua.ls Logo

Rohde & Schwarz NRP2 - Page 367

Rohde & Schwarz NRP2
419 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Annex
NRP2
366User Manual 1173.9140.02 ─ 07
printf("WinSocket initialization failed!\n");
return(1);
}
//---------------
// Create Sockets
//---------------
soLink1 = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
soLink2 = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if ((soLink1 == INVALID_SOCKET) || (soLink2 == INVALID_SOCKET))
{
printf("Creation of Sockets failed.\n");
return(1);
}
//---------------------------
// IP Address and Port of NRP2
//---------------------------
saDevice.sin_addr.s_addr = inet_addr(IP_ADDR);
saDevice.sin_port = htons((u_short) PORT_NO);
saDevice.sin_family = AF_INET;
//------------------
// Connecting Link 1
//------------------
nRet = connect(soLink1, (LPSOCKADDR) &saDevice, sizeof(SOCKADDR));
if (nRet)
{
printf("Connecting of Link 1 failed.\n");
return(1);
}
//------------------
// Connecting Link 2
//------------------
nRet = connect(soLink2, (LPSOCKADDR) &saDevice, sizeof(SOCKADDR));
if (nRet)
{
printf("Connecting of Link 2 failed.\n");
closesocket(soLink1);
return(1);
}
//----------
// send *SRE
//----------
nRet = send(soLink1, "*sre 0\r\n", strlen("*sre 0\r\n"), 0);
if (nRet == 0)
{
closesocket(soLink2);
Remote control interfaces
北京海洋兴业科技股份有限公司(证券代码:839145)
电话:010-62176775
网址:www.hyxyyq.com

Table of Contents

Related product manuals