From df95bde22603020221892ceadb87b904ee01f49e Mon Sep 17 00:00:00 2001 From: HappyTanuki Date: Sat, 26 Apr 2025 17:31:45 +0900 Subject: [PATCH] =?UTF-8?q?wsa=EB=AF=B8=EC=84=B8=EC=A1=B0=EC=A0=95=20?= =?UTF-8?q?=EB=B0=8F=20=EC=8A=A4=EB=A0=88=EB=93=9C=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=EC=9A=A9=20=EB=94=9C=EB=A0=88=EC=9D=B4=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/src/server.cpp | 5 ++--- include/Socket/WSAManager.hpp | 9 ++++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Server/src/server.cpp b/Server/src/server.cpp index e0af36b..825ea30 100644 --- a/Server/src/server.cpp +++ b/Server/src/server.cpp @@ -10,9 +10,7 @@ void _TCPClient(Chattr::TCPSocket sock, Chattr::Address addr); int main() { -#ifdef _WIN32 struct Chattr::WSAManager wsaManager; -#endif auto config = Chattr::ConfigManager::load(); Chattr::log::setDefaultLogger(config.logLevel, config.logFileName, config.logfileSize, config.logfileCount); @@ -41,10 +39,11 @@ int main() { sock.accept(clientSock, clientAddr); Chattr::Thread thread_(_TCPClient, std::move(clientSock), clientAddr); + thread_.deatch(); } } void _TCPClient(Chattr::TCPSocket sock, Chattr::Address addr) { spdlog::info("Connection accepted! from: {}, {}", sock, (std::string)addr); - + Sleep(10000); } \ No newline at end of file diff --git a/include/Socket/WSAManager.hpp b/include/Socket/WSAManager.hpp index 86a6eaa..1a8b180 100644 --- a/include/Socket/WSAManager.hpp +++ b/include/Socket/WSAManager.hpp @@ -2,20 +2,23 @@ #include "precomp.hpp" #include "Socket/Log.hpp" -#ifdef _WIN32 + namespace Chattr { struct WSAManager { WSAManager() { +#ifdef _WIN32 WSADATA wsa; if (WSAStartup(MAKEWORD(2, 2), &wsa) != 0) log::critical("WSAStartup()"); +#endif } ~WSAManager() { +#ifdef _WIN32 WSACleanup(); +#endif } }; -} -#endif \ No newline at end of file +} \ No newline at end of file