An abstract class representing a network connection, inherited by Server and Client classes.
More...
#include <connection.h>
|
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 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 |
|
An abstract class representing a network connection, inherited by Server and Client classes.
◆ runInternal()
void BoBRobotics::Net::Connection::runInternal |
( |
| ) |
|
|
overrideprotectedvirtual |
◆ setCommandHandler()
void BoBRobotics::Net::Connection::setCommandHandler |
( |
const std::string & |
commandName, |
|
|
const CommandHandler & |
handler |
|
) |
| |
Add a handler for a specified type of command.
e.g. if it's an IMG command, it should be handled by Video::NetSource. Set to nullptr to disable and ignore these commands.
The documentation for this class was generated from the following files:
- include/net/connection.h
- src/net/connection.cc