Remote Control Basics
R&S
®
SMJ100A
459
Operating Manual 1403.7458.32 ─ 14
serverAddress.sin_port = htons( currentPort );
memcpy( (char *) &serverAddress.sin_addr.s_addr, currentHostInfo->
h_addr_list[0], currentHostInfo->h_length );
if( connect( currentSocketDescr, ( struct sockaddr *) &serverAddress,
sizeof(serverAddress ) ) < 0 )
{
throw string("can't connect server\n" );
}
clientIsConnected = true;
}
}
void TcpClient::disconnect( )
{
if( clientIsConnected )
{
#ifndef LINUX
closesocket( currentSocketDescr );
#else
close( currentSocketDescr );
#endif
}
currentSocketDescr = 0;
currentHostName = "";
currentPort = 0;
currentHostInfo = NULL;
clientIsConnected = false;
}
void TcpClient::transmit( string &txString )
{
if( !clientIsConnected )
{
throw string("connection must be established before any data can be sent\n");
}
char * transmitBuffer = new char[txString.length() +1];
memcpy( transmitBuffer, txString.c_str(), txString.length() );
transmitBuffer[txString.length()] = '\n'; //newline is needed!
if( send( currentSocketDescr, transmitBuffer, txString.length() + 1, 0 ) < 0 )
{
throw string("can't transmit data\n");
}
delete [] transmitBuffer;
}
void TcpClient::receive( string &rxString )
{
if( !clientIsConnected )
{
throw string("connection must be established before any data can be received\n");
}
char * receiveBuffer = new char[receiveBufferSize];
memset( receiveBuffer, 0, receiveBufferSize );
Starting a Remote Control Session
Summary of Contents for SMJ100A
Page 34: ...Preface R S SMJ100A 18 Operating Manual 1403 7458 32 14 Notes on Screenshots...
Page 86: ...Preparing for Use R S SMJ100A 70 Operating Manual 1403 7458 32 14 LXI Configuration...
Page 826: ...Remote Control Commands R S SMJ100A 810 Operating Manual 1403 7458 32 14 UNIT Subsystem...
Page 828: ...Maintenance R S SMJ100A 812 Operating Manual 1403 7458 32 14 Storing and Packing...
Page 844: ...Hardware Interfaces R S SMJ100A 828 Operating Manual 1403 7458 32 14 BERT Connector...