14.06.2014 Views

R&S WinIQSIM2 Software Manual - Rohde & Schwarz

R&S WinIQSIM2 Software Manual - Rohde & Schwarz

R&S WinIQSIM2 Software Manual - Rohde & Schwarz

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

R&S ® <strong>WinIQSIM2</strong><br />

Automation of R&S <strong>WinIQSIM2</strong><br />

Remote Control Basics<br />

int currentSocketDescr;<br />

SockAddrStruct serverAddress;<br />

HostInfoStruct * currentHostInfo;<br />

bool clientIsConnected;<br />

int receiveBufferSize;<br />

};<br />

TcpClient.cpp<br />

#ifdef LINUX<br />

#include <br />

#include <br />

#endif<br />

#include "TcpClient.h"<br />

TcpClient::TcpClient()<br />

: currentHostName( "" )<br />

, currentPort( 0 )<br />

, currentSocketDescr( 0 )<br />

, serverAddress ( )<br />

, currentHostInfo( NULL )<br />

, clientIsConnected( false )<br />

, receiveBufferSize( 1024 )<br />

{}<br />

TcpClient::~TcpClient()<br />

{<br />

currentHostInfo = NULL;<br />

}<br />

void TcpClient::connectToServer( string &hostname, int port )<br />

{<br />

currentHostInfo = gethostbyname( hostname.c_str( ) );<br />

if( currentHostInfo == NULL )<br />

{<br />

#ifndef LINUX<br />

int error = WSAGetLastError();<br />

switch (error)<br />

{<br />

case WSANOTINITIALISED: throw string(" A successful case WSAStartup<br />

call must occur before using this function."); break;<br />

case WSAENETDOWN: throw string<br />

(" The network subsystem has failed."); break;<br />

case WSAHOST_NOT_FOUND: throw string<br />

(" Authoritative answer host not found."); break;<br />

case WSATRY_AGAIN: throw string<br />

(" Nonauthoritative host not found, or server failure."); break;<br />

case WSANO_RECOVERY: throw string<br />

(" A nonrecoverable error occurred."); break;<br />

case WSANO_DATA: throw string<br />

(" Valid name, no data record of requested type."); break;<br />

case WSAEINPROGRESS: throw string(" A blocking Windows Sockets 1.1 call<br />

<strong>Software</strong> <strong>Manual</strong> 1008.0858.42 ─ 10<br />

139

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!