From 205c09a338834949fe0f1ca92b9727bf08a1a7df Mon Sep 17 00:00:00 2001 From: Persson-dev Date: Wed, 12 Mar 2025 19:07:29 +0100 Subject: [PATCH] move SocketHandle to TcpTag --- include/sp/extensions/tcp/TcpListener.h | 2 ++ include/sp/extensions/tcp/TcpSocket.h | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/sp/extensions/tcp/TcpListener.h b/include/sp/extensions/tcp/TcpListener.h index 98ed8bb..07e2e06 100644 --- a/include/sp/extensions/tcp/TcpListener.h +++ b/include/sp/extensions/tcp/TcpListener.h @@ -10,6 +10,8 @@ namespace io { */ class TcpListener : private NonCopyable { public: + using SocketHandle = TcpTag::SocketHandle; + /** * \brief Starts listening for guests to connect * \param port The port to listen to diff --git a/include/sp/extensions/tcp/TcpSocket.h b/include/sp/extensions/tcp/TcpSocket.h index 1b14f3f..2ec39d3 100644 --- a/include/sp/extensions/tcp/TcpSocket.h +++ b/include/sp/extensions/tcp/TcpSocket.h @@ -6,9 +6,9 @@ namespace sp { namespace io { -using SocketHandle = int; - -struct TcpTag {}; +struct TcpTag { + using SocketHandle = int; +}; class SocketError : public std::exception { private: @@ -25,6 +25,8 @@ class SocketError : public std::exception { template <> class IOInterface : private NonCopyable { public: + using SocketHandle = TcpTag::SocketHandle; + /** * \enum Status * \brief Describes the state of a socket