![]() |
BoB robotics
The Brains on Board robotics library
|
General-purpose TCP client. More...
#include <client.h>
Public Member Functions | |
Client (const std::string &host=getDefaultIP(), uint16_t port=DefaultListenPort) | |
Create client and connect to host over TCP. | |
const std::string & | getIP () const |
![]() | |
template<typename... Ts> | |
Connection (Ts &&... args) | |
Default listening port. | |
bool | isOpen () const |
void | setCommandHandler (const std::string &commandName, const CommandHandler &handler) |
Add a handler for a specified type of command. More... | |
void | read (void *buffer, size_t length) |
Read a specified number of bytes into a buffer. | |
SocketWriter | getSocketWriter () |
Return a transaction object for writing to this Connection's Socket. | |
std::string | readNextCommand () |
![]() | |
virtual void | run () |
Run on the current thread, blocking until process ends. | |
virtual bool | isRunning () |
Check if the run() function has been called. | |
virtual void | runInBackground () |
Run the process on a background thread. | |
virtual void | stop () |
Stop the background thread. | |
Static Public Member Functions | |
static std::string | getDefaultIP () |
Additional Inherited Members | |
![]() | |
static constexpr size_t | DefaultBufferSize = 1024 * 8 |
static constexpr int | DefaultListenPort = 2000 |
Default buffer size, in bytes. | |
![]() | |
Socket & | getSocket () |
virtual void | runInternal () override |
virtual void | runInternal ()=0 |
General-purpose TCP client.
To be used with corresponding Server object. Various sink/source-type objects are used for either sending or receiving data from the server.