wsamanager 분리

This commit is contained in:
2025-04-26 17:21:54 +09:00
parent 81d912cc5e
commit 1418cf6880
5 changed files with 28 additions and 16 deletions

View File

@@ -6,7 +6,7 @@ namespace Chattr {
class Socket {
public:
Socket();
Socket() = default;
Socket(int domain, int type, int protocol);
~Socket();

View File

@@ -0,0 +1,21 @@
#pragma once
#include "precomp.hpp"
#include "Socket/Log.hpp"
#ifdef _WIN32
namespace Chattr {
struct WSAManager {
WSAManager() {
WSADATA wsa;
if (WSAStartup(MAKEWORD(2, 2), &wsa) != 0)
log::critical("WSAStartup()");
}
~WSAManager() {
WSACleanup();
}
};
}
#endif

View File

@@ -5,6 +5,7 @@
#include <ws2tcpip.h>
#include <ws2bth.h>
#include <windows.h>
#define in_addr_t ULONG
#elif __linux__
#include <sys/types.h>
#include <sys/socket.h>