대입 연산자는 윈도우에서 뭔지 모를 버그가 있으니 그냥 이렇게 하는걸로.
This commit is contained in:
@@ -3,6 +3,6 @@
|
|||||||
#include "precomp.hpp"
|
#include "precomp.hpp"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
struct Chattr::Socket_Init socket;
|
struct Chattr::Socket_Init sock(AF_INET, SOCK_DGRAM, 0);
|
||||||
std::cout << "Hello, world!" << socket << std::endl;
|
std::cout << "Hello, world!" << sock << std::endl;
|
||||||
}
|
}
|
||||||
@@ -4,11 +4,6 @@
|
|||||||
|
|
||||||
namespace Chattr {
|
namespace Chattr {
|
||||||
|
|
||||||
Socket_Init::Socket_Init(const SOCKET& socket) {
|
|
||||||
sock_ = socket;
|
|
||||||
valid_ = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Socket_Init::Socket_Init(std::int32_t domain, std::int32_t type, std::int32_t protocol)
|
Socket_Init::Socket_Init(std::int32_t domain, std::int32_t type, std::int32_t protocol)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|||||||
@@ -5,18 +5,16 @@ namespace Chattr {
|
|||||||
|
|
||||||
struct Socket_Init {
|
struct Socket_Init {
|
||||||
public:
|
public:
|
||||||
Socket_Init() {}
|
|
||||||
Socket_Init(std::int32_t domain, std::int32_t type, std::int32_t protocol);
|
Socket_Init(std::int32_t domain, std::int32_t type, std::int32_t protocol);
|
||||||
~Socket_Init();
|
~Socket_Init();
|
||||||
|
|
||||||
Socket_Init(const SOCKET& socket);
|
|
||||||
Socket_Init(const Socket_Init&) = delete;
|
Socket_Init(const Socket_Init&) = delete;
|
||||||
Socket_Init& operator=(const Socket_Init&) = delete;
|
Socket_Init& operator=(const Socket_Init&) = delete;
|
||||||
|
|
||||||
operator SOCKET() const;
|
operator SOCKET() const;
|
||||||
private:
|
private:
|
||||||
bool valid_ = false;
|
bool valid_ = false;
|
||||||
SOCKET sock_;
|
SOCKET sock_ = INVALID_SOCKET;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#define SOCKET std::int32_t
|
#define SOCKET int
|
||||||
#define INVALID_SOCKET -1
|
#define INVALID_SOCKET -1
|
||||||
#else
|
#else
|
||||||
#error "이 플랫폼은 지원되지 않습니다."
|
#error "이 플랫폼은 지원되지 않습니다."
|
||||||
|
|||||||
Reference in New Issue
Block a user