Public Member Functions | Private Member Functions | Private Attributes | List of all members
cISTcpClient Class Reference

#include <ISTcpClient.h>

Inheritance diagram for cISTcpClient:
Inheritance graph
[legend]

Public Member Functions

 cISTcpClient ()
 
int Close () OVERRIDE
 
bool GetBlocking ()
 
void HttpGet (const string &subUrl, const string &userAgent, const string &userName, const string &password)
 
bool IsOpen ()
 
int Open (const string &host, int port, int timeoutMilliseconds=IS_SOCKET_DEFAULT_TIMEOUT_MS)
 
int Read (void *data, int dataLength) OVERRIDE
 
int SetBlocking (bool blocking)
 
int Write (const void *data, int dataLength) OVERRIDE
 
virtual ~cISTcpClient ()
 
- Public Member Functions inherited from cISStream
 cISStream ()
 
virtual int Flush ()
 
virtual long long GetBytesAvailableToRead ()
 
virtual ~cISStream ()
 

Private Member Functions

 cISTcpClient (const cISTcpClient &copy)
 

Private Attributes

bool m_blocking
 
string m_host
 
int m_port
 
socket_t m_socket
 

Detailed Description

Definition at line 25 of file ISTcpClient.h.

Constructor & Destructor Documentation

◆ cISTcpClient() [1/2]

cISTcpClient::cISTcpClient ( )

Constructor

Definition at line 217 of file ISTcpClient.cpp.

◆ ~cISTcpClient()

cISTcpClient::~cISTcpClient ( )
virtual

Destructor

Definition at line 225 of file ISTcpClient.cpp.

◆ cISTcpClient() [2/2]

cISTcpClient::cISTcpClient ( const cISTcpClient copy)
private

Member Function Documentation

◆ Close()

int cISTcpClient::Close ( )
virtual

Close the client

Returns
0 if success, otherwise an error code

Reimplemented from cISStream.

Definition at line 285 of file ISTcpClient.cpp.

◆ GetBlocking()

bool cISTcpClient::GetBlocking ( )
inline

Get whether the client socket is blocking - blocking reads do not return until the data is read or a timeout occurs. Default is false.

Returns
whether the client is a blocking socket

Definition at line 88 of file ISTcpClient.h.

◆ HttpGet()

void cISTcpClient::HttpGet ( const string &  subUrl,
const string &  userAgent,
const string &  userName,
const string &  password 
)

Send a GET http request to a url. You must then call Read to get the response. SSL is NOT supported.

Parameters
subUrlthe url to request, i.e. index.html or pages/page1.txt, etc.
userAgentthe user agent to send
userNameoptional user name (basic authentication)
passwordoptional password (basic authentication)

Definition at line 310 of file ISTcpClient.cpp.

◆ IsOpen()

bool cISTcpClient::IsOpen ( )
inline

Get whether the connection is open

Returns
true if connection open, false if not

Definition at line 82 of file ISTcpClient.h.

◆ Open()

int cISTcpClient::Open ( const string &  host,
int  port,
int  timeoutMilliseconds = IS_SOCKET_DEFAULT_TIMEOUT_MS 
)

Closes, then opens a tcp client

Parameters
hostthe host or ip address to connect to
portthe port to connect to on the host
timeoutMillisecondsthe max milliseconds to wait for a successful connection before aborting
Returns
0 if success, otherwise an error code

Definition at line 231 of file ISTcpClient.cpp.

◆ Read()

int cISTcpClient::Read ( void *  data,
int  dataLength 
)
virtual

Read data from the client

Parameters
datathe buffer to read data into
dataLengththe number of bytes available in data
Returns
the number of bytes read or less than 0 if error

Reimplemented from cISStream.

Definition at line 290 of file ISTcpClient.cpp.

◆ SetBlocking()

int cISTcpClient::SetBlocking ( bool  blocking)

Sets whether the client socket is blocking. Default is false.

Returns
0 if success otherwise an error code

Definition at line 323 of file ISTcpClient.cpp.

◆ Write()

int cISTcpClient::Write ( const void *  data,
int  dataLength 
)
virtual

Write data to the client

Parameters
datathe data to write
dataLengththe number of bytes to write
Returns
the number of bytes written or less than 0 if error

Reimplemented from cISStream.

Definition at line 300 of file ISTcpClient.cpp.

Member Data Documentation

◆ m_blocking

bool cISTcpClient::m_blocking
private

Definition at line 102 of file ISTcpClient.h.

◆ m_host

string cISTcpClient::m_host
private

Definition at line 100 of file ISTcpClient.h.

◆ m_port

int cISTcpClient::m_port
private

Definition at line 101 of file ISTcpClient.h.

◆ m_socket

socket_t cISTcpClient::m_socket
private

Definition at line 99 of file ISTcpClient.h.


The documentation for this class was generated from the following files:


inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:18:02