From 7c3a27d64a2bc8373822b7f1ffbc8832537e006e Mon Sep 17 00:00:00 2001 From: Alexander Zhirov Date: Wed, 21 Sep 2022 08:31:23 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B8=D0=B4=D0=B5=D0=B8=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D0=B4=D0=B0=D0=BB=D1=8C=D0=BD=D0=B5=D0=B9=D1=88=D0=B5=D0=B3?= =?UTF-8?q?=D0=BE=20=D1=80=D0=B0=D0=B7=D0=B2=D1=82=D0=B8=D1=8F=20=D1=81?= =?UTF-8?q?=D0=B5=D1=80=D0=B2=D0=B5=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lesson_04/server/tcp_server.cpp | 20 +++++++++++++++----- lesson_04/server/tcp_server.hpp | 12 +++++++++++- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/lesson_04/server/tcp_server.cpp b/lesson_04/server/tcp_server.cpp index 0b26b9a..db90e6c 100644 --- a/lesson_04/server/tcp_server.cpp +++ b/lesson_04/server/tcp_server.cpp @@ -18,11 +18,6 @@ namespace azh { } - TCPServer::~TCPServer() - { - - } - int TCPServer::run() { try @@ -52,4 +47,19 @@ namespace azh startAccept(); }); } + + template + void writeToConnection(int connectionIndex, const T& message) + { + + } + + template + using listenCallback = std::function; + + template + void registerListenCallback(int connectionIndex, listenCallback callback) + { + + } } diff --git a/lesson_04/server/tcp_server.hpp b/lesson_04/server/tcp_server.hpp index aa400a1..9d29a60 100644 --- a/lesson_04/server/tcp_server.hpp +++ b/lesson_04/server/tcp_server.hpp @@ -10,6 +10,7 @@ #include #include #include +#include namespace azh { @@ -22,8 +23,17 @@ namespace azh { public: TCPServer(IPV ipv, int port); - virtual ~TCPServer(); + int run(); + + template + void writeToConnection(int connectionIndex, const T& message); + + template + using listenCallback = std::function; + + template + void registerListenCallback(int connectionIndex, listenCallback callback); private: IPV _ipVersion; int _port;