리눅스랑 코드 동기화

This commit is contained in:
2025-05-01 16:33:52 +09:00
parent d3161edb36
commit 4fb5bdd4cb
14 changed files with 279 additions and 144 deletions

View File

@@ -9,7 +9,8 @@ public:
void init(std::shared_ptr<ThreadPool> __IOCPThread);
void recv();
int recv(void* __restrict __buf, size_t __n, int __flags);
int send(const void* __buf, size_t __n, int __flags);
private:
std::shared_ptr<ThreadPool> IOCPThread_;

View File

@@ -11,22 +11,13 @@ public:
Socket(int domain, int type, int protocol);
~Socket();
void init(int domain, int type, int protocol);
int init(int domain, int type, int protocol);
void destruct();
operator SOCKET();
void set(const SOCKET);
void set(const SOCKET __sock, int __domain);
void bind(sockaddr *__addr);
void bind(sockaddr *__addr, socklen_t __len);
//IPV4
void bind(sockaddr_in *__addr);
void bind(sockaddr_in *__addr, socklen_t __len);
//IPV6
void bind(sockaddr_in6 *__addr);
void bind(sockaddr_in6 *__addr, socklen_t __len);
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);
@@ -37,6 +28,9 @@ public:
Socket& operator=(Socket&&);
struct Address bindAddr = {};
struct Address remoteAddr = {};
int domain = 0;
protected:
bool valid_ = false;
SOCKET sock_ = INVALID_SOCKET;

View File

@@ -7,10 +7,10 @@ class TCPSocket : public Socket {
public:
using Socket::Socket;
using Socket::init;
void init(int domain);
void listen(int __n);
int init(int domain);
int listen(int __n);
void accept(TCPSocket& newSock, Address& addr);
void connect(Chattr::Address& serveraddr);
int connect(Chattr::Address& serveraddr);
int recv(void *__restrict __buf, size_t __n, int __flags);
int send(const void *__buf, size_t __n, int __flags);
};