![]() |
Libftpp
A modern C++ library
|
Basic TCP client class using POSIX sockets and select() for network communication. More...
#include <client.hpp>
Public Member Functions | |
| Client () | |
| Client (const std::string &address, const size_t &port) | |
| void | connect (const std::string &address, const size_t &port) |
| void | disconnect () |
| void | defineAction (const Message::Type &messageType, const std::function< void(const Message &msg)> &action) |
| void | send (const Message &message) |
| void | update () |
Basic TCP client class using POSIX sockets and select() for network communication.
This class provides a simple TCP client implementation with message-based communication. It supports asynchronous message handling through callback functions and maintains connection state using file descriptors and select() for non-blocking operations.
| std::out_of_range | on message parsing errors |
| std::runtime_error | on network connection errors |
| May | re-throw any exceptions from registered callback functions |
Definition at line 62 of file client.hpp.
| Client::Client | ( | ) |
Definition at line 3 of file client.cpp.
| Client::Client | ( | const std::string & | address, |
| const size_t & | port | ||
| ) |
Definition at line 5 of file client.cpp.
References connect().
| void Client::connect | ( | const std::string & | address, |
| const size_t & | port | ||
| ) |
| void Client::defineAction | ( | const Message::Type & | messageType, |
| const std::function< void(const Message &msg)> & | action | ||
| ) |
Definition at line 53 of file client.cpp.
| void Client::disconnect | ( | ) |
Definition at line 43 of file client.cpp.
Referenced by connect().
| void Client::send | ( | const Message & | message | ) |
Definition at line 59 of file client.cpp.
References Message::getSerializedData().
| void Client::update | ( | ) |
Definition at line 127 of file client.cpp.