идеи для дальнейшего развтия сервера

This commit is contained in:
Alexander Zhirov 2022-09-21 08:31:23 +03:00
parent e8c1ace236
commit 7c3a27d64a
2 changed files with 26 additions and 6 deletions

View File

@ -18,11 +18,6 @@ namespace azh
{
}
TCPServer::~TCPServer()
{
}
int TCPServer::run()
{
try
@ -52,4 +47,19 @@ namespace azh
startAccept();
});
}
template<typename T>
void writeToConnection(int connectionIndex, const T& message)
{
}
template<typename T>
using listenCallback = std::function<void(int, const T&)>;
template<typename T>
void registerListenCallback(int connectionIndex, listenCallback<T> callback)
{
}
}

View File

@ -10,6 +10,7 @@
#include <boost/asio.hpp>
#include <connection/connection.hpp>
#include <vector>
#include <functional>
namespace azh
{
@ -22,8 +23,17 @@ namespace azh
{
public:
TCPServer(IPV ipv, int port);
virtual ~TCPServer();
int run();
template<typename T>
void writeToConnection(int connectionIndex, const T& message);
template<typename T>
using listenCallback = std::function<void(int, const T&)>;
template<typename T>
void registerListenCallback(int connectionIndex, listenCallback<T> callback);
private:
IPV _ipVersion;
int _port;