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

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() int TCPServer::run()
{ {
try try
@ -52,4 +47,19 @@ namespace azh
startAccept(); 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 <boost/asio.hpp>
#include <connection/connection.hpp> #include <connection/connection.hpp>
#include <vector> #include <vector>
#include <functional>
namespace azh namespace azh
{ {
@ -22,8 +23,17 @@ namespace azh
{ {
public: public:
TCPServer(IPV ipv, int port); TCPServer(IPV ipv, int port);
virtual ~TCPServer();
int run(); 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: private:
IPV _ipVersion; IPV _ipVersion;
int _port; int _port;