EasyManuals Logo

R&S SMB100A User Manual

R&S SMB100A
528 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
Page #270 background imageLoading...
Page #270 background image
Remote Control Basics
R&S
®
SMB100A
255Operating Manual 1407.0806.32 ─ 21
TcpClient::~TcpClient()
{
currentHostInfo = NULL;
}
void TcpClient::connectToServer( string &hostname, int port )
{
currentHostInfo = gethostbyname( hostname.c_str( ) );
if( currentHostInfo == NULL )
{
currentHostName = "";
currentPort = 0;
currentHostInfo = NULL;
clientIsConnected = false;
printf("error connecting host\n" );
}
currentHostName = hostname;
currentPort = port;
currentSocketDescr = socket(AF_INET, SOCK_STREAM, 0);
if( currentSocketDescr == 0 )
{
currentHostName = "";
currentPort = 0;
currentHostInfo = NULL;
clientIsConnected = false;
printf("can't create socket\n" );
}
serverAddress.sin_family = currentHostInfo->h_addrtype;
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 )
{
close( currentSocketDescr );
}
currentSocketDescr = 0;
currentHostName = "";
currentPort = 0;
currentHostInfo = NULL;
clientIsConnected = false;
}
Starting a Remote Control Session

Table of Contents

Other manuals for R&S SMB100A

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the R&S SMB100A and is the answer not in the manual?

R&S SMB100A Specifications

General IconGeneral
BrandR&S
ModelSMB100A
CategoryInverter
LanguageEnglish