Remote Control Basics
R&S
®
SMU200A
464Operating Manual 1007.9845.32 ─ 15
{}
TcpClient::~TcpClient()
{
currentHostInfo = NULL;
}
void TcpClient::connectToServer( string &hostname, int port )
{
currentHostInfo = gethostbyname( hostname.c_str( ) );
if( currentHostInfo == NULL )
{
#ifndef LINUX
int error = WSAGetLastError();
switch (error)
{
case WSANOTINITIALISED: throw string(" A successful case WSAStartup
call must occur before using this function."); break;
case WSAENETDOWN: throw string
(" The network subsystem has failed."); break;
case WSAHOST_NOT_FOUND: throw string
(" Authoritative answer host not found."); break;
case WSATRY_AGAIN: throw string
(" Nonauthoritative host not found, or server failure."); break;
case WSANO_RECOVERY: throw string
(" A nonrecoverable error occurred."); break;
case WSANO_DATA: throw string
(" Valid name, no data record of requested type."); break;
case WSAEINPROGRESS: throw string(" A blocking Windows Sockets 1.1 call
is in progress, or the service provider is still processing a callback function.")
; break;
case WSAEFAULT: throw string
(" The name parameter is not a valid part of the user address space."); break;
case WSAEINTR: throw string
(" A blocking Windows Socket 1.1 call was canceled through case
WSACancelBlockingCall."); break;
}
#endif
currentHostName = "";
currentPort = 0;
currentHostInfo = NULL;
clientIsConnected = false;
throw string("error connecting host\n" );
}
else
{
currentHostName = hostname;
currentPort = port;
currentSocketDescr = socket(AF_INET, SOCK_STREAM, 0);
if( currentSocketDescr == 0 )
{
Starting a Remote Control Session