#pragma once #include "Socket.h" #include namespace VWeb { class SocketUtils { public: static bool MakeAsync(int socketId); static bool Add(int socketId); static bool Close(int socketId); static bool WriteDone(int socketId); static WriteState Write(SendData &); }; class ServerConfig; class SocketManager { public: explicit SocketManager(const Ref &); ~SocketManager(); Accept Handle(); bool SetSendListen(int socketID); bool SetReadListen(int socketID); Ref &GetServerConfig() { return m_ServerConfig; } [[nodiscard]] int ID() const { return m_SocketID; } [[nodiscard]] bool IsErrored() const { return m_IsErrored; } void Init(); protected: void Errored(const std::string &data); int m_SocketID{}; Ref m_ServerConfig{}; struct sockaddr_in m_Address { 0 }; int m_AddressLength{sizeof(m_Address)}; bool m_IsErrored{false}; }; } // namespace VWeb