#pragma once #include "Socket/Address.hpp" namespace Chattr { struct Address; class Socket { public: Socket() = default; Socket(int domain, int type, int protocol); ~Socket(); int init(int domain, int type, int protocol); void destruct(); operator SOCKET(); void set(const SOCKET __sock, int __domain); int bind(Address __addr); int recvfrom(void *__restrict __buf, size_t __n, int __flags, struct Address& __addr); int sendto(const void *__buf, size_t __n, int __flags, struct Address __addr); Socket(const Socket&) = delete; Socket(Socket&&); Socket& operator=(const Socket&) = delete; Socket& operator=(Socket&&); struct Address bindAddr = {}; struct Address remoteAddr = {}; int domain = 0; protected: bool valid_ = false; SOCKET sock_ = INVALID_SOCKET; }; }